2017 © Pedro Peláez
 

cli-helper phook

Helper class for creating PHP Git Hooks

image

codestaq/phook

Helper class for creating PHP Git Hooks

  • Sunday, February 10, 2013
  • by gmanricks
  • Repository
  • 2 Watchers
  • 6 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PHP-GIT-Hooks

A PHP Class for Helping you run custom functions in Git Hooks, (*1)

Usage

You can install the package through composer using:, (*2)

{
  "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:, (*3)

  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., (*4)

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., (*5)

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:, (*6)

  $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., (*7)

The supported Colors are: - black - red - green - yellow - blue - magenta - cyan - white - clear (no Formatting) - plain (reset to default Formatting), (*8)

For more Examples Consult the TestHook file., (*9)

Credits

This is a Project created by Gabriel Manricks. You can follow me on twitter at: @gabrielmanricks, (*10)

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)., (*11)

The Versions

10/02 2013

dev-master

9999999-dev https://github.com/gmanricks/PHP-GIT-Hooks

Helper class for creating PHP Git Hooks

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

git cli

10/02 2013

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/gmanricks/PHP-GIT-Hooks

Helper class for creating PHP Git Hooks

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

git cli

10/02 2013

v1.0

1.0.0.0 https://github.com/gmanricks/PHP-GIT-Hooks

Helper class for creating PHP Git Hooks

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

git cli