项目作者: HasinaNjaratin

项目描述 :
Setup Drupal (8/9) with composer and grumphp for code-quality tools
高级语言: PHP
项目地址: git://github.com/HasinaNjaratin/drupal8-boilerplate.git
创建时间: 2019-08-15T11:38:31Z
项目社区:https://github.com/HasinaNjaratin/drupal8-boilerplate

开源协议:

下载


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

Table of Contents

Composer

To install php components, run

  1. composer install

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

  1. composer require drupal/devel:~1.0

To check component version, run

  1. composer outdated

To update composer packages, run

  1. 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 : 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)

in settings.php

  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. drush cim -y

To export

  1. drush csex -y

Translations

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

To check for updates

  1. drush locale-check

To update

  1. drush locale-update

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. ./vendor/bin/phpcs --standard=Drupal,DrupalPractice -p --colors ./www/modules/custom
  • Run phpcsf to fix all php code style evaluations that can be fixed automatically :
  1. ./vendor/bin/phpcbf --standard=Drupal,DrupalPractice -p --colors ./www/modules/custom
  • Run phpcs to summary php code style evaluations :
  1. ./vendor/bin/phpcs --report=summary --standard=Drupal,DrupalPractice -p --colors ./www/modules/custom

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.