Composer plugin for installing PHP_CodeSniffer standards
A collection of composer plugins for specific installation instruction for composer packages.
Important: if you are running on Flow 3+ and have the typo3/ci-flow package installed using your main distributions composer.json you should remove it there and install the codesniffer in a separate folder, like for example: https://git.typo3.org/Neos/Distributions/Base.git/tree/refs/heads/master:/Build/PhpCodesniffer
The PHP Codesniffer Standard installer is able to install phpcs codesniffer
standards into the
folder. By doing so the standard will be usable by calling
bin/phpcs --standard <standard>.
- Find the package containing the codesniffs you want to use. This package should be
a normal Codesniffing package containing a
- The composer package type has to be
- The name of the package has to reflect the name of the standard (explained below)
- It's best if the package has a requirement to
simplyadmire/composer-plugins. This is the only way to be sure the installer is available before the package is installed.
- Now add the package as a development dependency to your project
bin/phpcs -iand see your standard listed
The name of the standard is derived from the composer packagekey. The part after the
is taken as standard name. The first character is made uppercase, and all characters after
- will be uppercased. So:
The TYPO3 community already has packages available on packagist, and as renaming packagenames
would be a bad practice we added 3 hardcoded standard names. Also the vendor name
always be enforced to be uppercase.
To include the TYPO3 CGL to your project you can use one of the following commands (depending on the CGL you want to use, TYPO3 Flow or TYPO3 CMS):
composer require --dev typo3-ci/typo3flow=dev-master
composer require --dev typo3-ci/typo3cms=dev-master
Now you can sniff your packages with for example:
bin/phpcs --extensions=php --standard=TYPO3Flow Packages/Application/My.Package