rugaard / git-hooks-php
PHP related Git hooks.
Installs: 74
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:git-hook
Requires
- php: ^8.0
- ext-json: *
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0
- rugaard/git-hooks: ^1.0
- squizlabs/php_codesniffer: ^3.0
Requires (Dev)
- roave/security-advisories: dev-latest
README
This is a "plugin" package which seamlessly integrates with the Git Hooks package.
It will install git
hooks, that will automatically run multiple checks on your projects PHP files, to make sure they do not contain errors and follow the expected coding standards.
📦 Installation
You install the package via Composer by using the following command:
composer require rugaard/git-hooks rugaard/git-hooks-php
📝 Configuration
To change the default configuration of one or more script, you need to have a git-hooks.config.json
file in your project root. If you don't, you can create it with the following command:
./vendor/bin/git-hooks config
Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpCodeStyleCommand
Checks all staged .php
files for coding style errors.
Note: By default, if a valid config
has not been provided, this command will look for phpcs.xml
or phpcs.xml.dist
as an alternative.
If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.
Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpLintCommand
Checks all staged .php
files for syntax errors.
Script has nothing to configure
Rugaard\GitHooks\PHP\Hooks\PreCommit\PhpStaticAnalysisCommand
Statically analyzes all (or staged) .php
files for errors.
Note: By default, if a valid config
has not been provided, this command will look for phpstan.neon
or phpstan.neon.dist
as an alternative.
If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.
Rugaard\GitHooks\PHP\Hooks\PrePush\PhpTestSuiteCommand
Runs the projects test suite(s).
* Requires pest
to be installed in your project
Note: By default, if a valid config
has not been provided, this command will look for phpunit.xml
or phpunit.xml.dist
as an alternative.
If it finds any of those options, the above paramters will be ignored, and the configuration file will take priority.
🚓 License
This package is licensed under MIT.