unh3ck3d/php-cs-fixer-git-hook
最新稳定版本:v1.0.0
Composer 安装命令:
composer require unh3ck3d/php-cs-fixer-git-hook
包简介
Git hook running PHP CS Fixer on staged files using CaptainHook
README 文档
README
php-cs-fixer-git-hook
Git hook running PHP CS Fixer on staged files using CaptainHook
Report Bug
·
Request Feature
About The Project
Git hook that with each git commit command runs Php Cs Fixer
on staged files to automatically fix them and re-stage before committing.
Requirements
- PHP >= 8.0
- CaptainHook >= 5.0
- PHP CS Fixer
Installation
- Install package as a dev dependency using composer
composer require --dev unh3ck3d/php-cs-fixer-git-hook - Add the following code to your
captainhook.jsonconfiguration file{ "pre-commit": { "enabled": true, "actions": [ { "action": "\\Unh3ck3d\\PhpCsFixerGitHook\\LintStagedFiles" } ] } } - Install newly added hook by following CaptainHook docs
That's it. From now on after running git commit files that were staged will be
automatically fixed by Php Cs Fixer.
Configuration
You can customize the behaviour how git hook is run by changing following options
| Option | Description |
|---|---|
| phpCsFixerPath | Path to Php Cs Fixer executable. Defaults to ./vendor/bin/php-cs-fixer. |
| pathMode | path-mode cli option of Php Cs Fixer. Defaults to intersection. |
| config | config cli option of Php Cs Fixer. Defaults to .php-cs-fixer.dist.php. |
| additionalArgs | String of additional arguments that will be passed to Php Cs Fixer process. |
e.g.
{
"pre-commit": {
"enabled": true,
"actions": [
{
"action": "\\Unh3ck3d\\PhpCsFixerGitHook\\LintStagedFiles",
"options": {
"phpCsFixerPath": "php-cs-fixer.phar",
"pathMode": "overwrite",
"config": ".php-cs-fixer.php",
"additionalArgs": "-v --dry-run --diff"
}
}
]
}
}
License
Distributed under the MIT License. See LICENSE for more information.
统计信息
- 总下载量: 8.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知