codestaq/phook 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

codestaq/phook

最新稳定版本:v1.0

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: @gabrielmanricks

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).

统计信息

  • 总下载量: 18
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固