spryker/git-hook
Composer 安装命令:
composer require spryker/git-hook
包简介
Spryker Git hooks
README 文档
README
GitHook for Spryker. This tool will add Git hooks to your local hooks directory.
Currently, we have only one hook named pre-commit.
This will execute on every commit the applied commands.
Installation
composer require --dev spryker/git-hook
Setup
Add the Composer scripts to your composer.json
For core
"scripts": {
"post-install-cmd": [
"GitHook\\Composer\\Scripts\\HookInstaller::installSprykerHooks",
"GitHook\\Composer\\Scripts\\HookInstaller::installEcoHooks"
],
"post-update-cmd": [
"GitHook\\Composer\\Scripts\\HookInstaller::installSprykerHooks",
"GitHook\\Composer\\Scripts\\HookInstaller::installEcoHooks"
]
For projects
"scripts": {
"post-install-cmd": [
"GitHook\\Composer\\Scripts\\HookInstaller::installProjectHooks"
],
"post-update-cmd": [
"GitHook\\Composer\\Scripts\\HookInstaller::installProjectHooks"
]
}
This will copy the git hooks to your .git/hooks/ directory.
Configuration
Place a .githook file into the root of your project. Inside of this file you can configure the commands.
You can also use your private configuration by creating a .githook_local file and ignore it in your projects .gitignore` file.
Enable commands
To enable commands you need to specify them. An example configuration could look like this:
preCommitFileCommands:
- GitHook\Command\FileCommand\PreCommit\ArchitectureCheckCommand
- GitHook\Command\FileCommand\PreCommit\CodeStyleCheckCommand
- GitHook\Command\FileCommand\PreCommit\CodeStyleFixCommand
- GitHook\Command\FileCommand\PreCommit\PhpMdCheckCommand
- GitHook\Command\FileCommand\PreCommit\PhpStanCheckCommand
preCommitRepositoryCommands:
- GitHook\Command\RepositoryCommand\PreCommit\ValidateBranchNameCommand
- GitHook\Command\RepositoryCommand\PreCommit\GitAddCommand
See the full list of available commands in src/GitHook/Command/FileCommand/ and src/GitHook/Command/RepositoryCommand/.
Note: GitHook\Command\RepositoryCommand\PreCommit\GitAddCommand will automatically add all new files into commit, when other commands changed the files ( CodeStyleFixCommand does it for example), so use it only when you really need it!
PhpStanCheckCommand configuration
config:
phpstan:
level: 8
config: .phpstan.neon
Commands
We have two different type of commands. FileCommands will be executed for each file of a given commit. RepositoryCommands will be executed on the whole repository.
spryker/git-hook 适用场景与选型建议
spryker/git-hook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 845.69k 次下载、GitHub Stars 达 5, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「standards」 「sniffer」 「architecture」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 spryker/git-hook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spryker/git-hook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 spryker/git-hook 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
PHP_CodeSniffer custom Sniff for Laravel coding standard
Internal PHP coding standard of ProjektMOTOR
A set of abstractions that define core services provided by the DVSA
This is the ZooRoyal coding standard.
PHP Codesniffer ruleset to follow Laravel's coding style
统计信息
- 总下载量: 845.69k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知