Local developement environment for Drupal 9 based on Lando and WSL2.
Project is based on this article.
Here is article how to setup Lando inside WSL2 Ubuntu
Go to docroot directory and install Drupal 9 using composer
lando start
lando composer create-project drupal/recommended-project ./
Go to docroot directory and
lando composer require drupal/module_name
e.g. lando composer require drupal/admin_toolbar
To install drush run command
lando drush-install
To use drush run command
lando drush your_command
Requirements:
- php >= 7.0.8
- php extension mbstring
- Composer v2
- Composer packages:
- squizlabs/php_codesniffer
- drupal/coder
- dealerdirect/phpcodesniffer-composer-installer
- phpcs extension for VS Code,
- PHP Sniffer & Beautifier extension for VS Code.
- Copy sample.vscode directory as .vscode
First install phpcs executable and Drupal standard globally
composer global require squizlabs/php_codesniffer drupal/coder dealerdirect/phpcodesniffer-composer-installer
Then add Drupal standard to phpcs
cd ~/.config/composer/vendor
bin/phpcs --config-set installed_paths drupal/coder/coder_sniffer/
Then install VS Code extensions. In .vscode directory in project edit settings.json, lines:
- phpcs.executablePath
- phpsab.executablePathCBF
- phpsab.executablePathCS
and change {username} to your username in WSL.
Requirements:
- php >= 7.0.8
- Composer v2
- Composer package: friendsoftwig/twigcs
- Copy sample.vscode directory as .vscode
First install twigcs executable
composer global require friendsoftwig/twigcs
Then install VS Code extension. In .vscode directory in project edit settings.json, line twigcs.executablePath and change {username} to your username in WSL.
- Start / build lando
lando start
- Stop lando
lando stop
- Rebuild lando app
lando rebuild
- Destroy app (containers, databse, NOT FILES!)
lando destroy
- Import database
lando db-import path/to/file.sql
- Connect to container's shell
lando ssh
- Enable xdebug
lando xdebug-on
- Disable xdebug
lando xdebug-off
- Node command
lando node <command>
- NPM command
lando npm <command>
- Gulp command
lando gulp <command>