What does it do?#

All the PHP tools run PHP_CodeSniffer (phpcs/phpcbf) via a single, shared, community-maintained image (texthtml/phpcs, PHP_CodeSniffer 4.0.1). The alias names below are mnemonics for the project type you’re working on — only phpcs-drupal/phpcbf-drupal actually bake in a flag (--extensions=php,inc,install,module,theme). None of the aliases bake in --standard=...; you configure the coding standard yourself via a .phpcs.xml in your project root, or by passing --standard= explicitly.

GitHub: https://github.com/willhallonline/docker-devtools-aliases

Generic (PSR1, PSR2, Generic, Squiz, PEAR, Zend)#

Aliases#

phpcs-generic="docker_alias /app texthtml/phpcs:latest phpcs"
phpcbf-generic="docker_alias /app texthtml/phpcs:latest phpcbf"

Usage#

phpcs-generic --standard=PSR12 src/
phpcbf-generic --standard=PSR12 src/

Drupal#

phpcs-drupal="docker_alias /app texthtml/phpcs:latest phpcs --extensions=php,inc,install,module,theme"
phpcbf-drupal="docker_alias /app texthtml/phpcs:latest phpcbf --extensions=php,inc,install,module,theme"

Only --extensions= is baked in; the coding standard is not.

phpcs-drupal --standard=Drupal src/
phpcbf-drupal --standard=Drupal src/

Note: phpcs-d / phpcbf-d are a completely separate, non-Docker pair. They call local Composer-installed binaries directly — ~/.composer/vendor/bin/phpcs / phpcbf — with --standard= hardcoded to the local path of drupal/coder’s Drupal sniffs and the same --extensions= list. They require a local composer global require drupal/coder install and do not spin up a container.

WordPress#

phpcs-wordpress="docker_alias /app texthtml/phpcs:latest phpcs"
phpcbf-wordpress="docker_alias /app texthtml/phpcs:latest phpcbf"
phpcs-wordpress --standard=WordPress src/
phpcbf-wordpress --standard=WordPress src/

Laravel#

phpcs-laravel="docker_alias /app texthtml/phpcs:latest phpcs"
phpcbf-laravel="docker_alias /app texthtml/phpcs:latest phpcbf"
phpcs-laravel --standard=Laravel src/
phpcbf-laravel --standard=Laravel src/

Yii#

phpcs-yii="docker_alias /app texthtml/phpcs:latest phpcs"
phpcbf-yii="docker_alias /app texthtml/phpcs:latest phpcbf"
phpcs-yii --standard=Yii src/
phpcbf-yii --standard=Yii src/

CakePHP#

phpcs-cakephp="docker_alias /app texthtml/phpcs:latest phpcs"
phpcbf-cakephp="docker_alias /app texthtml/phpcs:latest phpcbf"
phpcs-cakephp --standard=CakePHP src/
phpcbf-cakephp --standard=CakePHP src/

Composer & PHP CLI#

Composer is mainly used as a building block for other containers, but you can use it directly to install dependencies or run Composer tasks.

composer-docker="docker_alias /app composer:latest composer"
php-docker="docker_alias /app php:8.4-alpine php"
composer-docker install
composer-docker require symfony/console
php-docker script.php

Container images#

docker pull texthtml/phpcs:latest
docker pull composer:latest
docker pull php:8.4-alpine