metasyntactical / composer-codesniffer-hooks
PHP CodeSniffer script hooks for composer
Installs: 64
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/metasyntactical/composer-codesniffer-hooks
Requires
- php: >= 5.5.0
- ext-mbstring: *
- squizlabs/php_codesniffer: ~2.3
Requires (Dev)
- composer/composer: ~1.0@dev
- phpunit/phpunit: ~4.5
This package is auto-updated.
Last update: 2020-01-31 00:38:40 UTC
README
Hooks to enable PHP CodeSniffer with the Coding Standard configurable after running composer install or composer update.
The project is abandoned!
This project is abandoned in favor of captainhook/captainhook providing general git hooks management. Everything in this repository can be achieved with captainhook/captainhook.
Install
Install dependency via composer:
$ composer require --dev metasyntactical/composer-codesniffer-hooks
Add scripts to composer post hooks:
"scripts": { "post-install-cmd": [ "MetaSyntactical\\CodeSniffer\\Composer\\ScriptHandler::addPhpCsToPreCommitHook" ], "post-update-cmd": [ "MetaSyntactical\\CodeSniffer\\Composer\\ScriptHandler::addPhpCsToPreCommitHook" ] }
Add the codesniffer standard which has been installed as dependency (e.g. "metasyntactical/symfony-coding-standard") to the extra field in composer.json:
"extras": { "codesniffer": { "standard": { "dependency": "metasyntactical/symfony-coding-standard" } } }
On each composer install or composer update the hook will be deployed to the local git repository.
Usage
Every time you try to commit, PHP_CodeSniffer will run on changed .php files only. There is nothing to do manually.