DEV Community 👩‍💻👨‍💻

Esnare Maussa
Esnare Maussa

Posted on • Updated on

Using Lando with Drupal 9

Alt Text
After years of working with MAMP, I decided to move my development stack to Docker and Docker Compose. I did it mainly out of curiosity as many of my colleagues were getting very excited with it.

And there I went, I started to dive deep into Docker compose, I learnt how to create my own docker files, use Dockerhub and started to master the syntax from Docker Compose. Nevertheless, it seemed to me that I had to do so much boiler to spin up a workable Drupal site.

One day, while browsing on the web, I found Lando!

Lando, - as they put it from their website - it's a free and open-source local development environment built on Docker container technology. Just by running on command: lando start, you are able to run a fully LAMP-based infrastructure regardless of what OS you're using.

$ lando start
Enter fullscreen mode Exit fullscreen mode

Lando is not only for Drupal but it also gives you a pool of frameworks to choose from. Very effortless, you are able to run Drupal, Laravel, WordPress and many more.

Installation

Just head out to their installation page, they couldn't make it easier:
https://docs.lando.dev/basics/installation.html

Drupal 9 Configuiration

After installing Lando locally, you can run lando init, that command will help you to configure your site step by step.

$ lando init
Enter fullscreen mode Exit fullscreen mode

At the end of the process, you should end up having a .lando.yml file, similar to the one below:

#.lando.yml
name: my-project
recipe: drupal9
config:
  webroot: web
  php: "7.4"
Enter fullscreen mode Exit fullscreen mode

You can achieve the same by copying and pasting the code above into a .lando.yml file inside of your root directory and then just run lando start

Running Drush

You can run Drush commands by prefixing lando at the beginning of the command, such as lando drush command

#Example
$ lando drush cr
Enter fullscreen mode Exit fullscreen mode

You won't have to worry about the Drush configuration anymore, Lando will take care that you are using the right PHP version and the right Drush version for your Drupal site.

More info about lando

Here are some interesting links about Lando:
Debugging Drupal 9 with Xdebug and (VSCode || PHPStorm)

Lando Overview

Lando Drupal9 recipe

Tooling with Lando

Top comments (0)

🌚 Browsing with dark mode makes you a better developer by a factor of exactly 40.

It's a scientific fact.