joaorobertopb / php-githook-sniffer
Php-GitHook-Sniffer is a simple collection of automated and customizable tasks that you can perform with your git repository through the hooks.
0.0.5
2018-02-23 14:22 UTC
Requires
- php: ^5.6 || >=7.0 <7.3
- friendsofphp/php-cs-fixer: ^2.2
- league/pipeline: ^0.3
README
Php-GitHook-Sniffer is a simple collection of automated tasks that you can perform with your git repository through the hooks.
Available hooks
- pre-commit
pre-commit
Check the commited files:
- Check PHP Syntax (with PHPLint)
- Fix code style according to PSR2 standard
Examples
verifying syntax:
Applying PSR2 rules:
Other Hooks
Coming Soon.
Install
Add joaorobertopb/php-githook-sniffer
as a development dependency in composer.json
"require-dev": {
"joaorobertopb/php-githook-sniffer": "~0.0.5"
}
Or via Composer
$ composer require joaorobertopb/php-githook-sniffer --dev
Copy src/Hooks/pre-commit for .git/hooks. ( Execution Permission Required )
$ php -r "if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}"
or
"scripts": {
"post-install-cmd": [
"php -r \"if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}\""
],
"post-update-cmd": [
"php -r \"if(file_exists('./.git')&&file_exists('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit')){copy('./vendor/joaorobertopb/php-githook-sniffer/src/Hooks/pre-commit','./.git/hooks/pre-commit');chmod('./.git/hooks/pre-commit',0777);}\""
]
}
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
Coming Soon.
Credits
License
The MIT License (MIT). Please see License File for more information.