Skip to content
Field note

Local Mautic Development Using Lando

Follow the steps to set up Lando as the first local development environment for Mautic.

October 7, 2022·2 min read·Mohit Aghera, Axelerant Alumni/ Field correspondent
Local Mautic Development Using Lando

Introduction

The experts at Axelerant were recently working on a couple of Mautic plugins. The team preferred using Lando as a first local development environment setup choice because of its flexibility and other benefits.

Find how the team used Lando to set up a development environment for Mautic here.

Setting Up A Development Environment For Mautic

Follow the steps below to set up local Mautic development using Lando.

Step 1: Installing Lando

First, you need to install Lando in your system. Start by downloading the most recent version. Your current Docker Desktop version might get affected as Lando bundles a compatible Docker inside its setup.
Choose not to install the Docker Desktop if you wish to retain your current docker version. Refer to the Lando installation guide for more details.

Step 2: Mautic Installation

Once the Lando setup is done, it's time to clone the new Mautic repo and create the project. You can begin the setup by cloning the Mautic 3.x branch. Afterward, go to the directory and run the ‘lando init’ command to initiate the Lando setup.

Step 3: Lando Init

The Lando init command will initiate the lando installation and ask a few questions to set up the Lando application. Provide the following answers to the questions.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

Now it will ask for the application name. Once that is done, you are finished setting up, and your bare lando.yml file will look like this.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

Extending And Tooling Support

Specific PHP and MySQL versions are typically used to ensure exact matches between production and local stacks. You can do this by adding the versions.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

In some cases, you might have to add additional PHP extensions. Make sure to specify that in the additional section for services. You must also add other services like XDebug for debugging.

This section specifies additional PHP configuration via php.ini specific to the project. To do this, create a directory called '.lando' in the project root and place the php.ini file in the 'php' directory.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

Refer to this repository to check the code for php.ini.

While working in Mautic, you can check and view the sample emails locally by configuring Mailhog.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

You need to run 'lando ssh' for Mautic's console commands or use the tooling to run those without ssh. If you opt for the latter, add the 'tooling' section in Lando, relevant services, and commands.

Finally, to complete this setup, run the 'lando start' command to start the Lando. Your final lando.yml will look like this.

[@portabletext/react] Unknown block type "tableBlock", specify a component for it in the `components.types` prop

Additional Information

During Mautic installation, you will need database-related information, which can be accessed by running the ‘lando info’ command. The database information for the current example used is given below.
Database name: 'lamp'
Password: 'lamp'
User name: 'lamp'
Host: 'database'
Port: '3306'
The information for Mailhog is given below as well.
Host: 'mailhog' Port: '1025'
This information can be used for setting up email support in the third step of the installer. Once Mautic is up and running, users can run a few console-related commands like cache:clear and mautic:segments:update.
These commands can be directly run using a custom command named ‘mt.’ Running ‘lando mt’ will equal ‘php bin:console’ inside the container. To access all the logs from the app, run the ‘lando logs’ command.

The Conclusion

Users can also extend Lando according to new requirements and additional tooling support by referring to the basic steps for running the Mautic website. You can explore further by referring to the Lando documentation.

Companion brief

Bring this dispatch into a working session - one page in, scoping memo out.

Brief Foyer
Pressure-test "Field note" with a partner

If this dispatch landed, bring it into a room with us.

The argument in "Local Mautic Development Using Lando" is ours - but every situation breaks the argument differently. Send the situation in one page and a named partner will reply inside one business day with a scoping memo: where the argument holds for you, where it bends, and what we'd actually do in the first two weeks.

One-pager · Field note

By submitting this form you acknowledge that you have read Axelerant's Privacy Policy and agree to its terms.

Replied to by a named partner within one business day.