Skip to content

Local developement environment for Drupal 9 based on Lando and WSL2

License

Notifications You must be signed in to change notification settings

Niyabi/lando-wsl2-for-drupal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lando-wsl2-for-drupal

Local developement environment for Drupal 9 based on Lando and WSL2.
Project is based on this article.

Requirements

Here is article how to setup Lando inside WSL2 Ubuntu

Drupal 9 installation

Go to docroot directory and install Drupal 9 using composer

lando start
lando composer create-project drupal/recommended-project ./

Module instalation

Go to docroot directory and

lando composer require drupal/module_name

e.g. lando composer require drupal/admin_toolbar

Drush installation

To install drush run command

lando drush-install

Drush

To use drush run command

lando drush your_command

PHP Code Sniffer and PHP Code Beautifier and Fixer for VS Code

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.

Twig Code Sniffer

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.

Commands

  • 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>

About

Local developement environment for Drupal 9 based on Lando and WSL2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published