DEV Community

loading...

Using Lando with Drupal 9

esnaremaussa profile image Esnare Maussa ・2 min read

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

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

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"

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

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

Discussion

pic
Editor guide