Skip to content

Local development setup with Lando

Lando is a free, open source, cross-platform local development tool built on Docker. It lets you mimic a cloud-hosting environment locally. You may prefer it over DDEV, especially if you are using it already.

Before you start, you'll need Composer, Docker Desktop and Lando installed. The getting started guide covers installing these.

Code editors

Lots of people use VS Code. Open source IDE for code editing. https://code.visualstudio.com/

Some people like PHPStorm https://www.jetbrains.com/phpstorm/ (not free / not open source)

Install LocalGov Drupal locally

To install LocalGov Drupal locally for testing or development, use the Composer-based project template.

If desired, change MY_PROJECT to whatever you'd like your project directory to be called.

composer create-project --no-install drupal/localgov_project:^4.0 MY_PROJECT

Change directory into the MY_PROJECT directory and run lando start.

cd MY_PROJECT
lando start

Lando will start local containers to run the web server and database for your local Drupal site.

Once started, we can use composer to download the rest of the code. As your host machine may run a different PHP version from Lando, it's advisable to run composer install from within Lando so dependencies reflect the PHP version the webserver actually runs.

lando composer install

With the code in place, we can now run the install.

lando drush si localgov -y

If you run into memory limit errors when running Composer commands, prefix the commands with COMPOSER_MEMORY_LIMIT=-1. The create-project step runs on your host machine before any containers exist, so this is not prefixed with lando:

COMPOSER_MEMORY_LIMIT=-1 composer create-project --no-install drupal/localgov_project:^4.0 MY_PROJECT

For Composer commands run after the project is started, prefix inside Lando instead:

lando composer install