read

ExtDN Installer Screenshot

One of the things that is more complicated than it should be in Magento 2 is the installation process of extensions. The installation of extensions is closely tied to the deployment process itself which even spawned it's own meme in the early days:

Keep Calm for Magento 2 Poster

A big problem in the installation process is the variability depending on your starting position. The installation process looks very different if your Magento site is running in production mode or in developer mode.

Side Note: In an ideal set up no one would install directly into a store that is running in production mode, rather each store should have a process that resembles something like this - install in a development environment, verify changes in a staging environment then push via an automated process to production. However the existing reality is that this is not always the case nor feasible.

Once you add in different configurations for locales and different versions of extensions one needs a flowchart to determine the best course of action. Additionally over the years working with Magento 2 we have picked up a range of abnormal starting positions (I sometimes call them booby traps unwittingly left behind) which can lead to headaches if not caught early. This installer represents our accumulated experience working with Magento 2 since 2015 to remove some of this complexity and includes a range of checks to prevent proceeding in those dangerous situations.

The installer itself is encapsulated in a phar file for distribution which you can download from here. Once downloaded compare a typical installation:

Before:

bin/magento deploy:mode:set developer (if you are in production mode)
composer require fooman/emailattachments-m2:^3.0
bin/magento module:enable --clear-static-content Fooman_EmailAttachments
bin/magento setup:upgrade
your usual sequence of commands to enable production mode, for example
bin/magento deploy:mode:set production

And this doesn't include any verification steps like file ownership, outdated composer information etc.

After:

./extdn_installer.phar install fooman/emailattachments-m2:^3.0

Open to all vendors

The installer is open to a wide range of sources to install from and is not limited to any specific vendor. Your package could be available via packagist.org, Marketplace (repo.magento.com) or Github. Further it will work for any other vendor that supplies their packages via a composer repository url. Simply supply your vendor name in the --template argument and provide the repository url via --repo-url. If your installation is not covered feel free to open a PR that provides a new template.

Looking to the future

We at Fooman are committed to using this installer for our own installations and are in the process of updating all our documentation and installation instructions to use them. I am keen to hear how the installer is working for you and am looking forward to collaborating with everyone to make this the rock solid and easy to use extension installer Magento 2 deserves. Any comments or suggestions please head over to the Github repo.

Blog Comments powered by Disqus.
Kristof Ringleff

Kristof Ringleff

Founder and Lead Developer at Fooman


Published

Want to receive our monthly email with the best Magento developer tips, tricks and news? Join 7000+ other Magento developers