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.sh
Log 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 directory
Downloads Drupal projects using Composer.
dl admin_toolbar token feeds
Rebuilds 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.yml
Executes scripts from vendor/bin directory.
dbin phpcbf --help
Launcher for Drush.
Checks the code against Drupal coding standards using PHP code sniffer.
drupalcs modules/custom/foo
Automatically tries to fix PHPCS issues using PHPCBF tool.
d-phpcbf modules/custom/foo
Launcher for PHPUnit.
dunit tests/src/Functional/SomeTest.php
Runs 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.