项目作者: HasinaNjaratin

项目描述 :
Setup Drupal (8/9) with Lando. Using Composer, xdebug and grumphp for code-quality tools
高级语言: PHP
项目地址: git://github.com/HasinaNjaratin/drupal-lando-boilerplate.git
创建时间: 2020-06-02T13:53:38Z
项目社区:https://github.com/HasinaNjaratin/drupal-lando-boilerplate

开源协议:

下载


This project template provides a starter kit to manage drupal project with Lando, xdebug and grumphp.
It is set with most popular and used modules for drupal, such as devel, config_split, paragraphs, etc …

Table of Contents

Lando

First you need to install lando.

Note: You might need to install docker if you do not yet install it for your setup.

After that you clone this project and run

  1. lando start

Note: Drupal will avalaible through http://drupal-lando-boilerplate.lndo.site:8080/.

Drupal generator

To init/create drupal website :

  1. lando site-install

All parameters about site installation (site name, admin login, etc …) are configured in .lando/settings/site_config.sh file.

Composer

To install php components, run

  1. lando composer install

With composer require ... you can download new dependencies to your
installation.
Example:

  1. lando composer require drupal/devel:~1.0

To check component version, run

  1. lando composer outdated

To update composer packages, run

  1. lando composer update

How can I apply patches to downloaded modules?

If you need to apply patches (depending on the project being modified, a pull
request is often a better solution), you can do so with the
composer-patches plugin.

To add a patch to drupal module foobar insert the patches section in the extra
section of composer.json:

  1. "extra": {
  2. "patches": {
  3. "drupal/foobar": {
  4. "Patch description": "URL or local path to patch"
  5. }
  6. }
  7. }

Use /patches directory to put patches files.

Xdebug

This project has a php with an xdebug installed and activated, ready to use.

To set it up with the IDE : Lando + xdebug + phpstorm

Configuration split

Use config_split module to manage configurations.

There are three splits of configurations :

  • dev : related to developpement environnement (/config/splits/dev)
  • horsprod : related to hors_prod environnement (/config/splits/horsprod)
  • prod : related to prod environnement (/config/splits/prod)
  1. $config['config_split.config_split.dev']['status'] = TRUE;
  2. $config['config_split.config_split.hors_prod']['status'] = FALSE;
  3. $config['config_split.config_split.prod']['status'] = FALSE;

To import

  1. lando drush cim -y

To export

  1. lando drush csex -y

Translations

You need to manage po files to configure multilanguage site case.

To check for updates

  1. lando drush locale-check

To update

  1. lando drush locale-update

Custom commands

To reinstall composer package, remove vendor, core and contrib modules/themes :

  1. lando composer-reset

To install or update local environment : install new components, update database, import configurations, etc …

  1. lando site-update

To reset database

  1. lando drush db-import <your-dump>.sql

Phpcs

Phpcs is necessary to control and continue coding in good practice.

The verification is done in the /www/modules/custom directory.

  • Run phpcs to list all php code style evaluations :
  1. lando phpcs
  • Run phpcsf to fix all php code style evaluations that can be fixed automatically :
  1. lando phpcs-fix
  • Run phpcs to summary php code style evaluations :
  1. lando phpcs-summary

Grumphp

grumphp is used to check the quality of codes before commits.

PhpLint, PhpUnit and PhpCs are launched at each commit.

Note: phpro/grumphp is fixed in 0.18.1 version because at the moment I write this doc, the recent version of grumphp is not compatible (has conflit) with some drupal dependencies.