How to change to Composer based Mautic 7.x?

System: Ubuntu 24.04 - Mautic 7.0.1 - PHP version is: 8.3.6 - Maradb: 10.11.13
My Mautic is in /var/www/html/mautic

I’d like to swith to composer based installation.

First: I’m completely new about composer - but i think, i need to install the composer first?
ChatGPT gave me this as information - but i don’t trust it 100%

Can anyone confirm, that this is the right install-routine for the composer?
If we have here a 100% working methode i would put it in the official manual of Mautic (after i changed my installation myself and check if all is working).

Install Composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version

Go to the path above
cd /var/www/html

Create a new project (for Mautic 7):

composer create-project mautic/recommended-project:^7 mautic-new --no-interaction
New directory has been created: /var/www/html/mautic-new with Composer structure

Explaining this command:

composer create-project mautic/recommended-project:^7 mautic-new --no-interaction

:one:composer create-project
This is a Composer command that creates a new project from a package.
It downloads the package including all dependencies into a new folder.
Similar to “downloading a ZIP file + extracting it + installing libraries”—only automatic and clean.

:two: mautic/recommended-project:^7

  • mautic/recommended-project → the official Composer package name of Mautic.
  • ^7 → the version restriction, meaning:

Meaning of ^7 in Composer

  • ^ means: compatible versions within the major version 7
  • So ^7 = “7.x.x, but not 8.x.x”
  • Example: Composer could install 7.6.1 or 7.9.0, but never 8.0, because that would potentially be incompatible

In short: ^7 ensures that Composer only downloads updates within the Mautic 7 series, which maintains stability and compatibility.

:three: mautic-new

  • This is the name of the folder where Composer installs the project.
  • After execution, the result is: /var/www/html/mautic-new

:four: --no-interaction

  • Composer does not ask for confirmation or input.
  • Useful for automated installations or scripts, so the command runs without manual intervention.

In short

Teil Meaning
composer create-project New project created from a package
mautic/recommended-project Mautic-Package-Name
^7 Version: all 7.x-versions, no 8.x
mautic-new target-folder
--no-interaction no imputs necessary

:light_bulb: Tip:
If you want to install Mautic 6, for example, you would use ^6.
For future versions, such as 8.x, then use ^8.

Copy folders from the existing installation

Configurations

cp -a /var/www/html/mautic/app/config/local.php /var/www/html/mautic-new/app/config/

Plugins
cp -a /var/www/html/mautic/plugins /var/www/html/mautic-new/

Uploads (Dateien und Bilder)

cp -a /var/www/html/mautic/media/files /var/www/html/mautic-new/media/files
cp -a /var/www/html/mautic/media/images /var/www/html/mautic-new/media/images

Dashboards

cp -a /var/www/html/mautic/media/dashboards /var/www/html/mautic-new/media/dashboards

Themes

cp -a /var/www/html/mautic/themes /var/www/html/mautic-new/themes

Übersetzungen

cp -a /var/www/html/mautic/translations /var/www/html/mautic-new/translations

Save old installation & activate new

sudo mv /var/www/html/mautic /var/www/html/mautic-old
sudo mv /var/www/html/mautic-new /var/www/html/mautic

Setting rights:

sudo chown -R www-data:www-data /var/www/html/mautic
sudo find /var/www/html/mautic -type f -exec chmod 644 {} +
sudo find /var/www/html/mautic -type d -exec chmod 755 {} +
sudo chmod -R g+w /var/www/html/mautic/var/cache \
                     /var/www/html/mautic/var/logs \
                     /var/www/html/mautic/app/config \
                     /var/www/html/mautic/media/files \
                     /var/www/html/mautic/media/images \
                     /var/www/html/mautic/translations

Check Apache:

Apache should access /var/www/html/mautic/public
Apache VirtualHost:

DocumentRoot /var/www/html/mautic/public
<Directory /var/www/html/mautic/public>
    AllowOverride All
    Require all granted
</Directory>

Delete Cache
sudo -u www-data php /var/www/html/mautic/bin/console cache:clear

Is that right? If yes, i would changed my installation and copy / adjust the way official manual for Mautic
If something is missed - or wrong - i need the experts here to adjust errors or add steps.
The result should be a changing tutorials for “beginners” like me.

Important question:
I have many images embended in my e-mails. Does it all works after changing to composer system (image folder has to move - is Mautic able to find the images)?

I tried out to install composer (that worked) but creation a new composer based mautic-new directory failed with some errors.

chatGPT said i have to install manually some things.

I don’t switch to the composer based installation until the Mautic Devs provide a step by step manual.

Hello stefan-franz,

Just a quick clarification about your Composer install example. In your solution you specify mautic-new as the target install directory, which implies creating a new folder.

However, on many hosting platforms (including ours) the target directory already exists, so there isn’t a need — and sometimes there isn’t even permission — to create a new one.

Does your Composer install approach support installing directly into an existing folder instead of creating a new directory? If so, could you clarify the recommended command or workflow for that scenario?

Also, I’ve seen the proposal to remove ZIP-based Mautic installations and move to Composer-only installs. Installing via ZIP is currently simple and quick, whereas Composer installs are more complex and involve multiple steps and dependencies.

Given that difference in complexity, can a developer kindly explain the reasoning behind removing the ZIP installation option - its just making the process more complex than it needs to be ?

Thanks you for your work.

i’ve running Mautic on my own Ubuntu 24.04 server. I have full access.

I agree 100% to you, that a composer installation makes the installation very much complicated.
I refuse to change it. It’s so complicated, that no working tutorial is in the Mautic documentation.

On problems no one knows if the composer had made issues or what the composer really exactly do. At the normal installation we can see if the database works and can download the files and all will working.

I suggest: First lets have a stable V7
And all would be happy.

Hello stefan-franz,

I completely agree — stability must be the absolute priority for Mautic 7. As an open-source marketing automation platform used in production environments around the world, including enterprise deployments, reliability isn’t optional — it’s foundational to trust in Mautic.