Installation and Distribution Options for Magento 2 Extensions




When it comes to installing extensions for Magento 2 you have a few different options available. I'll talk through each of those options from a developer and end user perspective. In the end I'll summarise what we use at Fooman to deliver extensions for our customers.

A big distinction to make is if this a freely available extension or if you don't want public access. Since the free ones are easier I'll start with that.

Distribution options for free extensions

Packagist

Packagist is provided by the same folks that have brought us Composer and support for it comes out of the box in a standard Magento installation. As the developer you would need to publically host your code (github is the most common choice here), link up your repository to packagist (a one time process) and from there you only need to push your tagged releases and packagist will take care of the rest.

For end users of the extension the installation process is also simple, a composer require fooman/printorderpdf-m2 is sufficient.

Developer perspective:
+ Easy one time setup
+ Easy release process
+ Free

End User perspective:
+ No extra repository configuration needed

Magento Marketplace

To get your extension listed on the Marketplace you as the developer need to pass through a few verification steps - these include a Business, Technical and Marketing Review. The upside for end users using Marketplace is that Magento is checking the extension and provides reviews by other users of the same extension.

Developer perspective:
- Release process is manual and time intensive
- Revenue share if the free extension provides a tie-in for a SaaS business
+ Exposure

End User perspective:
- Order needs to be placed
+ No extra repository configuration needed
+ Installation can be done via the Web Setup Wizard
+ Vetted by Magento / reviews
- Version number needs to be manually selected

Distribution options for paid extensions

Magento Marketplace

Developer perspective:
- Release process is manual and time intensive
- Revenue share
+ Exposure

End User perspective:
+ No extra repository configuration needed
+ Installation can be done via the Web Setup Wizard
+ Vetted by Magento
- Version number needs to be manually selected

Installation from a zip file

A one time extra repository configuration is needed: composer config repositories.foomanexample artifact $(pwd)/path/to/folder_with_zips. Please note that we have found that an absolute path is needed (the $(pwd) part) to not break Magento's Web Setup Wizard (it changes the Composer Home Folder on the fly and can't handle relative folder references).

Developer perspective:
- Release process is manual or requires setup
+ Free

End User perspective:
- One time extra repository configuration needed
- Manual actions required during install and update
- Does not play well with a multi-stage deployment process
+ No dependency on external factors

Installation from a private git repository

A one time extra repository configuration is needed for each extension: composer config repositories.foomanexampleext vcs https://github.com/fooman/private-extension-repo. Additionally you need a way to allow access to this repository which likely requires exchange of github user accounts, some public key exchange, or creating some other ssh key handling to faciliate access.

Developer perspective:
- Access Control Management likely manual
- Hard to implement support periods
+ Easy release process
- Likely per user based cost for granting access to the repository

End User perspective:
- One time extra repository configuration needed
+ Easy updates

Installation from a private composer repository

A one time extra repository configuration is needed: composer config repositories.foomanexample composer https://composer-repo.example.com. The same composer repository can be used for all extensions.

Developer perspective:
- Initial set up and hosting commitments
+ Easy release process
+ Minimal hosting costs

End User perspective:
- One time extra repository configuration needed
+ Easy updates

Other

Private Packagist could also be an option, however having to manage access control and support periods ruled this out for me so I didn't look into this further.

It is also possible to distribute an extension as a zip file that can be installed under app/code. However this option provides zero management of dependencies and comes with a higher risk for the merchants to end up with a broken store.

Another option I didn't mention is to install from a locally checked out repository. This would use composer config repositories.foomanexampleext path /path/to/local_repo. I don't believe it offers any benefits over the already listed approaches. Additionally the bundled Composer version for Magento prior to 2.2 is so old that it does not support the path repository.

What we do at Fooman

For free extension we aim to have the extensions available both via

  • Packagist
  • and Marketplace

to allow end users to pick their favorite method. We additionally offer installation from a zip file for our free extensions as well to provide consistency with our paid extension release model.

For paid extensions we again offer multiple options:

  • Marketplace (we will keep adding extensions over time)
  • Installation from a zip file
  • Installation from a private composer repository.

I am particular proud of our private composer repository option - thanks to Rafael for your help in getting this set up. When you place an order on our own Magento store a process is triggered in the background that creates/updates a composer repository (it utilises Satis under the hood). It's created for each licensed domain and is ultimately hosted on Amazon's S3 service (which comes with a promise of 99.99% uptime) and combined with Cloudfront. I am pleased to anounce that we will provide this hosting free of charge for a minimum of 5 years after purchase (we initially tied this against our free 12 months support period).

As always if you have any specific questions around installation of our extensions please get in touch via our Support Email.

Kristof Ringleff

Kristof Ringleff

Founder and Lead Developer at Fooman

Join the Fooman Community

We send our popular Fooman Developer Monthly email with Magento news, articles & developer tips, as well as occasional Fooman extension updates.