TL;DR I tried to prepare a composer.json file that would install Mautic in the the vendor foler. That wasn't the hard part. I got stuck on making Mautic work that way.

Using Composer to install PHP packages is great. Why shouldn't we install Mautic this way? I wanted to make it work mainly because I want to install Mautic plugins via Composer. And installing/updating Mautic with Composer would make it simpler.

It would allow to install and update plugins and themes as well as Mautic the same way - via Composer. And if we'd want to update Mautic and one of the plugins would not support the new Mautic version then Composer would tell us. That's quite useful information to know before the upgrade.

I'll document here what I did and where I got stuck so someone else with more patience could pick it up and continue. It's definitelly possible but it will probably need some changes in Mautic.

You can follow my steps by creating a new directory. Add this composer.json file in it:

    "name": "mautic/composer-install",
    "description": "Creates a new project and installs Mautic as a dependency. Then it will move to the right folder structure.",
    "type": "metapackage",
    "license": "GPLv3",
    "require": {
        "mautic/core": "^2"
    "repositories": [
            "type": "vcs",
            "url": ""
    "minimum-stability": "dev"

And then from that folder execute this command: composer create-project (install Composer if you don't have it yet)

That's all it takes to install Mautic as a dependency. My plan was to add several symlinks to the post-create-project-cmd sections to the index.php, console, etc. It will also need some paths chages to the autoloader as the path is different. But even if I fixed that Mautic did not load.

There would be other issues even if I made it load. Mautic writes quite a lot into its own file structure. Config file, assets, plugins, themes, cache. All those would have to be symlinked or configured outside of the vendor directory.

Edit: A similar and working project already exists:

Edit 2: There is a simple way how to install Mautic via Composer. Just not as a dependency but as its usual file structure.

Next Post Previous Post