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
To install php components, run
composer install
With composer require ...
you can download new dependencies to your
installation.
Example:
composer require drupal/devel:~1.0
To check component version, run
composer outdated
To update composer packages, run
composer update
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:
"extra": {
"patches": {
"drupal/foobar": {
"Patch description": "URL or local path to patch"
}
}
}
Use /patches directory to put patches files.
This project has a php with an xdebug installed and activated, ready to use.
To set it up with the IDE : xdebug + phpstorm
Use config_split module to manage configurations.
There are three splits of configurations :
- dev : related to developpement environnement (/config/splits/dev)
- hors_prod : related to hors_prod environnement (/config/splits/hors_prod)
- prod : related to prod environnement (/config/splits/prod)
in settings.php
$config['config_split.config_split.dev']['status'] = TRUE;
$config['config_split.config_split.hors_prod']['status'] = FALSE;
$config['config_split.config_split.prod']['status'] = FALSE;
To import
drush cim -y
To export
drush csex -y
You need to manage po files to configure multilanguage site case.
To check for updates
drush locale-check
To update
drush locale-update
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 :
./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 :
./vendor/bin/phpcbf --standard=Drupal,DrupalPractice -p --colors ./www/modules/custom
- Run phpcs to summary php code style evaluations :
./vendor/bin/phpcs --report=summary --standard=Drupal,DrupalPractice -p --colors ./www/modules/custom
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.