This project template provides a starter kit to manage drupal project with Docksal, xdebug and grumphp. It is set with most popular and used modules for drupal, such as devel, config_split, paragraphs, etc ...
Table of Contents
- Docksal
- Drupal generator
- Composer
- Xdebug
- Configuration Split
- Translations
- Particular commands
- PHPCS
- Grumphp
First you need to install docksal.
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
fin init
Monitor the console outputs carefully. The superadmin access will be returned there.
Note: Drupal will avalaible through
http://drupal-boilerplate.docksal:8080/
.
To create a drupal instance
fin site-install
will install the drupal website automatically according to configurations you have set in .docksal/settings/site_config.sh
Note: You no longer have to run this command if you have already run the
fin init
command. This is just to let you know that it exists and that you can use it if you want to re-install a new drupal install from the same docksal instance.
To install php components, run
fin composer install
With composer require ...
you can download new dependencies to your
installation.
Example:
fin composer require drupal/devel:~1.0
To check component version, run
fin composer outdated
To update composer packages, run
fin 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 : Docksal + 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)
$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
fin drush cim -y
To export
fin drush csex -y
You need to manage po files to configure multilanguage site case.
Translations directory is stored (configured) /config/translations
To check for updates
fin drush locale-check
To update
fin drush locale-update
To reinstall composer package, remove vendor, core and contrib modules/themes :
fin compoer-reset
To install or update local environment : install new components, update database, import configurations, etc ...
fin site-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 :
fin phpcs
- Run phpcsf to fix all php code style evaluations that can be fixed automatically :
fin phpcs-fix
- Run phpcs to summary php code style evaluations :
fin phpcs-summary
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.