Installing via Composer

Your software
My PHP version is : php8.0

Updating/Installing Errors
I am: Installing
Upgrading/installing via : Command Line

Your problem
My problem is :
I’m trying to understand the best way to install via composer so that the marketplace is usable, and there are no problems with upgrading mautic in the future. I find the official docs to not be clear about this. If all I want to do is set up a production server that can use the marketplace, should I be using the recommended project or should I just be doing a git clone from the 4.4 branch and then a composer install?

If I do the latter, how will I be able to update to future Mautic releases? Do I have to manually git pull and composer install for every release?

If I use the recommended project, how will updates to new mautic releases work?

It said somewhere in the docs that starting with version 5 composer will be the default installation method. Is that still the plan? If so, we really need to get our docs updated to make this stuff clearer…

@rcheesley Care to comment on this? If I can figure it out I’d be happy to pay it forward by improving the documentation…

Hi @gabe thanks for the ping.

You should install using recommended project, per the documentation.

You update Mautic’s core by following the documentation on the same page as the installation.

Indeed we do need to make things more user-friendly as regards the docs, these were very much written in haste before we released Composer support - would you like to help us with that?

I’d love it if we can make a ‘best practice for installing and updating Mautic’ page which gives a step-by-step of how to install and update with Composer for someone who isn’t a server-management expert.

We’re likely pushing back the mandatory use of Composer to 6.0 as we’ve simply not had the resources to get everything in place to support users with moving to Composer from manual installs (and getting the docs up to standard) yet.

That is very helpful, thank you @rcheesley! I will suggest changes to the docs based on this discussion. But I do need to fully understand it myself in order to do so, and I have a couple more questions:

  1. When I follow the instructions to migrate to composer using the recommended project documentation, I can’t get my Mautic to load at all. I believe that’s because many of the configs in local.php need to change to match the different folder structure of the recommended project but none of the current docs address that. Is it the case that the paths need to be adjusted when moving to a composer-based install and the docs just don’t cover that yet?
  2. How do updates work once you’re on composer? The documentation implies that composer update mautic/core-lib --with-dependencies will work but that only updates the PHP right? What about the db changes? Do the php bin/console mautic:update:find and php bin/console mautic:update:apply commands still work?

The way the docs are talking about the recommended project, it seems like it’s meant for folks who want to maintain their Mautic install off of a Github branch rather than just getting the default mautic install. This is especially true for the updating Mautic section, which seems to be written for people who have their own modifications (and is probably a very small percentage of the user base). I’m happy to address these things once I understand it myself…

Hi there,

  1. Please check the documentation on switching to a Composer based installation: How to switch to Composer — Mautic Documentation 0.1 documentation

  2. Please read the documentation which explains updating Mautic core, in particular, step 5:

5 Run the following commands to update your database with any changes from the release:

bin/console cache:clear
bin/console mautic:update:apply --finish
bin/console doctrine:migration:migrate --no-interaction
bin/console doctrine:schema:update --no-interaction --force
bin/console cache:clear

Hope that makes sense!

We probably do need to pull the updating Composer section into its own page under the Updating Mautic menu item, I guess.