sebastianfeldmann/captainhook
最新稳定版本:2.2.0
Composer 安装命令:
composer require sebastianfeldmann/captainhook
包简介
PHP git hook manager
README 文档
README
CaptainHook
CaptainHook is an easy to use and very flexible git hook library for php developers. It enables you to configure your git hook actions in a simple json file.
You can use CaptainHook to validate or prepare your commit messages, ensure code quality or run unit tests before you commit or push changes to git. You can automatically clear local caches or install the latest composer dependencies after pulling the latest changes.
CaptainHook makes it easy to share hooks within your team and even can make sure that everybody in your team activates the hooks locally.
You can run cli commands, use some built in validators, or write your own PHP classes that get executed by CaptainHook. For more information have a look at the documentation.
Install official version
Install the CaptainHook PHAR using Phive or download the PHAR from the github release page.
$ phive install captainhook
Or use Composer to install CaptainHook.
$ composer require --dev captainhook/captainhook
Setup
After installing CaptainHook you can use the captainhook executable to create a configuration.
$ vendor/bin/captainhook configure
Now there should be a captainhook.json configuration file.
If you are not using the composer-plugin yet you have to activate the hooks manually by installing them to your local .git repository. To do so just run the following captainhook command.
$ vendor/bin/captainhook install
Have a look at this short installation video.
If you want to make sure your whole team uses the same hooks and you want to make sure everybody has the hooks installed you can use the CaptainHook composer-plugin as an addition.
$ composer require --dev captainhook/plugin-composer
The plugin will make sure that the hooks get activated after every composer install or update. If you don't like the extra dependency just add the following scripts command to your composer.json file instead.
{ "scripts": { "post-autoload-dump": "vendor/bin/captainhook install -f -s" } } Configuration
Here's an example captainhook.json configuration file.
{ "commit-msg": { "enabled": true, "actions": [ { "action": "\\CaptainHook\\App\\Hook\\Message\\Action\\Beams", "options": [] } ] }, "pre-commit": { "enabled": true, "actions": [ { "action": "phpunit" }, { "action": "phpcs --standard=psr2 src" } ] }, "pre-push": { "enabled": false, "actions": [] } } Contributing
So you'd like to contribute to the CaptainHook library? Excellent! Thank you very much. I can absolutely use your help.
Have a look at the contribution guidelines.
sebastianfeldmann/captainhook 适用场景与选型建议
sebastianfeldmann/captainhook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 45.75k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「git」 「hooks」 「pre-commit」 「pre-push」 「commit-msg」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sebastianfeldmann/captainhook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sebastianfeldmann/captainhook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sebastianfeldmann/captainhook 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily manage git hooks in your composer config
Enforce coding standards on your PHP & Javascript. Now with SWagger Support. Don't let your team mess up your code base.
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
Nagios plugin to verify a git repository.
A lightweight WordPress hook helper library. Register hooks before WordPress loads, run callbacks only once, and more.
Hooks integrated in Voyager
统计信息
- 总下载量: 45.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 26
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-04