Hey, don't read the rest of this old, out dated article. Mautic can already do this and it's the preferred way:

https://docs.mautic.org/en/setup/how-to-install-mautic/install-and-manage-mautic-with-composer

The original article:

I just tested installing Mautic with Composer and it worked pretty well. Why isn't it the recommended way? Am I missing something? This is a follow up to how I failed installing Mautic with composer as a dependency. We can install Mautic in the same file structure as we are used to now with Composer.

The reason I'm playing with this is because I work on the Mautic Marketplace and I face an issue that all the plugins listed at Packagist are for Mautic 2. They must define what Mautic version they are for otherwise installing such plugin will break the Mautic installation. However, the mautic/core package is not listed at Packagist so the plugins cannot define the supported Mautic versions.

But let's get back to the other reason why Mautic should be listed at Packagist - how to install Mautic.

The currently recommended way

At this point if you look at the readme of Mautic you'll see that the recommended way how to install Mautic is to visit https://www.mautic.org/download, fill in the form to get the production zip package and then somehow upload it to the server. Someone will unzip it locally and FTP it one file after another to the server. Someone else will use a command like rsync to upload the zip file and then another command to extract it. Isn't that too much work?

The Git way

If you want to make changes to Mautic core and then provide the changes to the community or if you are building a plugin, use Git to install Mautic (git clone git@github.com:mautic/mautic.git && composer install). I want to focus on production installations in this post. Do not use Git to install Mautic in production.

The Composer way

It's as easy as executing this command:

composer create-project mautic/core mautic-dir-name ^2 --no-dev

If composer is an unknown command, install it first. Replace the mautic-dir-name with the directory where Mautic should be installed in. The ^2 part means that you want to install the latest Mautic 2 version.

There are unresolved issues like when the production package is being built then some files are being removed as they are not needed in production. Some files like upgrade.php and index_dev,php might be removed for security reasons. But we should be able to do all this in post-create-project-cmd.

Next Post Previous Post