maximumtest/php-git-hooks
Composer 安装命令:
composer require maximumtest/php-git-hooks
包简介
Git hooks for PHP projects.
README 文档
README
Git hooks for PHP projects.
Library based in git hook scripts for PHP projects.
Installation
Step 1: Composer
You must add the following line to the composer.json file to use with Symfony 3.0:
{
"require-dev": {
"bruli/php-git-hooks": "~4.1"
}
}
You can use "~2.0" for Symfony version 2.X.
Or you can write in your console:
$ composer require bruli/php-git-hooks --dev
If you don't have composer, you need download the binary file and run it:
$ wget http://getcomposer.org/composer.phar
# or
$ curl -O http://getcomposer.org/composer.phar
$ php composer.phar install
Step 2: Configuration
Using Composer
First, you will need to add the following lines to your composer.json
"scripts": { "post-install-cmd": [ "PhpGitHooks\\Infrastructure\\Composer\\ConfiguratorScript::buildConfig" ], "post-update-cmd": [ "PhpGitHooks\\Infrastructure\\Composer\\ConfiguratorScript::buildConfig" ] }
WARNING: "PhpGitHooks\Application\Composer\ConfiguratorScript::buildConfig" is deprecated. You need change by current entry.
Then, launch $ composer install and composer should ask you about configuration
Bin directory configuration.
If your project doesn't have a "bin/" directory, you can add this in your composer.json file.
"config": { "bin-dir": "bin" }
Note: This is not necessary for Symfony projects.
Manual config file for git hooks.
You can configure php-git-hooks, creating a php-git-hooks.yml file with...
pre-commit: enabled: true execute: php-cs-fixer: enabled: true levels: psr0: true psr1: true psr2: true symfony: true options: "--fixers=short_array_syntax --diff" phpunit: enabled: true random-mode: true options: '<some options>' strict-coverage: enabled: true minimum: 90 guard-coverage: enabled: true message: 'WARNING!!, your code coverage is lower.' phplint: true phpcs: enabled: true standard: PSR2 phpmd: enabled: true options: '<some options>' composer: true message: right-message: 'HEY, GOOD JOB!!' error-message: 'FIX YOUR CODE!!' commit-msg: enabled: true regular-expression: '#[0-9]{2,7}' pre-push: enabled: true execute: phpunit: enabled: true random-mode: true options: '<some options>' strict-coverage: enabled: true minimum: 90 guard-coverage: enabled: true message: 'WARNING!!, your code coverage is lower.' message: right-message: 'PUSH IT!!' error-message: 'YOU CAN NOT PUSH CODE!!'
... or you can copy php-git-hooks.yml.sample from vendor/bruli/php-git-hooks.
Config file for phpunit.
If you want use phpunit tool, you must create a phpunit.xml.dist in your project root directory. Alternatively you can copy from vendor/bruli/php-git-hooks/phpunit.xml.dist in your project root directory.
Config file for phpmd.
The same case that phpunit. You must create a PmdRules.xml in your project root directory or copy from php-git-hook directory.
Step 3: Enabling hooks.
The most easy way to enable hook is copy hook file into your .git/hooks directory.
For pre-commit hook:
You can enable this hooks with composer or manually executing
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/pre-commit .git/hooks
For commit-msg hook:
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/commit-msg .git/hooks
For pre-push hook:
$ cp vendor/bruli/php-git-hooks/src/PhpGitHooks/Infrastructure/Hook/pre-push .git/hooks
execute.
Valid pre-commit.
Fail pre-commit.
Credits
- Pablo Braulio (@brulics)
- All contributors
License
php-git-hooks is released under the MIT License. See the bundled LICENSE file for details.
maximumtest/php-git-hooks 适用场景与选型建议
maximumtest/php-git-hooks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 154 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「git」 「HOOK」 「quality」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 maximumtest/php-git-hooks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 maximumtest/php-git-hooks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 maximumtest/php-git-hooks 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A simple tool for checking that your PHP classes and methods use PHPDocs (PHP DocBlocks Checker fork).
Easily manage git hooks in your composer config
Taptima PHP-CS-Fixer fixers
Static analyzer tool for PHP : Coupling, Cyclomatic complexity, Maintainability Index, Halstead's metrics... and more !
Extensible package of custom rules for PHPStan.
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
统计信息
- 总下载量: 154
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-02


