Useful Bash functions for Drupal development.
# Local installation.
url=https://raw.githubusercontent.com/Chi-teck/drupalrc/master &&
wget -O $HOME/.drupalrc $url/drupalrc &&
echo source $HOME/.drupalrc >> $HOME/.bashrc &&
wget -O $HOME/.drupal.complete.sh $url/drupal.complete.sh &&
echo source $HOME/.drupal.complete.sh >> $HOME/.bash_completion# System-wide installation (run as super user).
url=https://raw.githubusercontent.com/Chi-teck/drupalrc/master &&
wget -O /etc/drupalrc $url/drupalrc &&
echo source /etc/drupalrc >> /etc/bash.bashrc &&
wget -O /etc/bash_completion.d/drupal.complete.sh $url/drupal.complete.shLog out and log in again for the changes to take effect.
Print absolute path to Drupal root directory.
Quick navigation between Drupal directories.
dcd views # core/modules/views
dcd files # sites/default/files
dcd contrib # modules/contrib
dcd themes # themes
dcd # Drupal root directoryDownloads Drupal projects using Composer.
dl admin_toolbar token feedsRebuilds Drupal caches using drush cr.
Opens specified configuration file in default editor.
dconf # settings.php
dconf settings.local.php # settings.local.php
dconf services.yml # services.ymlExecutes scripts from vendor/bin directory.
dbin phpcbf --helpLauncher for Drush.
Checks the code against Drupal coding standards using PHP code sniffer.
drupalcs modules/custom/fooAutomatically tries to fix PHPCS issues using PHPCBF tool.
d-phpcbf modules/custom/fooLauncher for PHPUnit.
dunit tests/src/Functional/SomeTest.phpRuns PHPStan analyze.
d-phpstan .Note
If the local phpstan.neon file is not found, a contrib version of the file
from Drupal CI will be downloaded to a temporary directory.
GNU General Public License, version 2.