Integration with Lando
Last updated on
5 September 2023
Integrating Drupal Coder and PHP CodeSniffer into Lando can help you maintain coding standards and improve code quality in your Drupal projects. This documentation will guide you through the process step by step.
Integrating Drupal Coder and PHP CodeSniffer into Lando
Create a .lando.yml with following code
name: drupal9
recipe: drupal9
config:
php: '8.1'
via: apache
webroot: web
proxy:
mailhog:
- mail.drupal9.lndo.site
services:
appserver:
build:
- "mkdir -p /app/coder && cd /app/coder && composer require drupal/coder:8.3.21"
node:
type: node:14
run:
- "cd $LANDO_MOUNT/web/themes/custom/themename && npm install"
- "cd $LANDO_MOUNT/web/themes/custom/themename && gulp sass"
globals:
gulp-cli: "latest"
pma:
type: phpmyadmin
hosts:
- database
mailhog:
type: mailhog
hogfrom:
- appserver
portforward: 1026
tooling:
phpcs:
service: appserver
cmd: "/app/coder/vendor/bin/phpcs --standard=Drupal,DrupalPractice"
options:
description: Run phpcs for given folder or file.
phpcbf:
service: appserver
cmd: "/app/coder/vendor/bin/phpcbf --standard=Drupal"
description: Automatically fix Drupal coding standards suggestions.
php:
service: appserver
npm:
service: node
gulp:
service: node
drush:
cmd: /app/vendor/bin/drush
Check Drupal best practices
lando phpcs --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_moduleAutomatically fix coding standards
lando phpcbf --standard=Drupal --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml /path/to/drupal/example_moduleWith these steps, you've successfully integrated Drupal Coder and PHP CodeSniffer into your Lando environment for Drupal development. You can now ensure that your Drupal code adheres to coding standards and maintain code quality in your projects.
Help improve this page
Page status: No known problems
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion