codestaq/phook
Composer 安装命令:
composer require codestaq/phook
包简介
Helper class for creating PHP Git Hooks
README 文档
README
A PHP Class for Helping you run custom functions in Git Hooks
Usage
You can install the package through composer using:
{
"require": {
"codestaq/phook": "1.0"
}
}
A created this class as verbose as possible, in terms of function names. So to run a simple function with a message before and after it you would type:
use Codestaq\PHook; $ph = new PHook; $ph->say("Downloading some Gunther ... ") ->thenRun(function(){ file_put_contents("Gunther.png", file_get_contents("https://dl.dropbox.com/u/30949096/Gunther.png")); })->andFinallySay("Done");
This will Download a picture of a Sassy Penguin to your PC.
There are more advanced commands like onTrigger which will only run the command when a special trigger keyword is found in the current commit message.
You may also add another Message to display when the command fails by using the unlessFails Command and all messages can be color coded using color names like so:
$ph->say("This ")->green("Sentence ")->red("is Super ")->white("Colorful")->withoutACommand();
The withoutACommand Function will just display the message without running any functions, it is worth noting that if you set a trigger, even though no function will be run, the message won't be displayed without the keyword.
The supported Colors are:
- black
- red
- green
- yellow
- blue
- magenta
- cyan
- white
- clear (no Formatting)
- plain (reset to default Formatting)
For more Examples Consult the TestHook file.
Credits
This is a Project created by Gabriel Manricks.
You can follow me on twitter at:
P.S.
Even though I wrote that this is a Git Hook Library, the only real Git related function is the triggers, so if you just need a Terminal printer with Color Support then this will work great (including the command part).
codestaq/phook 适用场景与选型建议
codestaq/phook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18 次下载、GitHub Stars 达 6, 最近一次更新时间为 2013 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「git」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 codestaq/phook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codestaq/phook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 codestaq/phook 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easily manage git hooks in your composer config
MediaWiki extension that allows embedding external content, specified by URL, into your wiki pages
Nagios plugin to verify a git repository.
GitHub Webhook Listener with plugin-based API for creating your own triggerered actions
Slim starter / Slim skeleton package to boost your development with Slim framework
This project will create a WordPress base installation using wp-cli/wp-cli package and using vlucas/phpdotenv package to expose configuration values in PHP $_ENV super global.
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-02-10