PHPackages                             codestaq/phook - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. codestaq/phook

ActiveCli-helper[CLI &amp; Console](/categories/cli)

codestaq/phook
==============

Helper class for creating PHP Git Hooks

v1.0(13y ago)618MITPHPPHP &gt;=5.3.0

Since Feb 10Pushed 13y ago1 watchersCompare

[ Source](https://github.com/gmanricks/PHP-GIT-Hooks)[ Packagist](https://packagist.org/packages/codestaq/phook)[ Docs](https://github.com/gmanricks/PHP-GIT-Hooks)[ RSS](/packages/codestaq-phook/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

PHP-GIT-Hooks
=============

[](#php-git-hooks)

A PHP Class for Helping you run custom functions in Git Hooks

Usage
-----

[](#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
-------

[](#credits)

This is a Project created by Gabriel Manricks. You can follow me on twitter at: [![@gabrielmanricks](https://camo.githubusercontent.com/12e2842d2c3c0a4fb05a6348e42578a7fd0a759811346969f1ede42331761586/68747470733a2f2f747769747465722e636f6d2f4761627269656c4d616e7269636b73)](https://camo.githubusercontent.com/12e2842d2c3c0a4fb05a6348e42578a7fd0a759811346969f1ede42331761586/68747470733a2f2f747769747465722e636f6d2f4761627269656c4d616e7269636b73)

### P.S.

[](#ps)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

4845d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/870b72f6ce701d12aba81be89f49816dc26b43b4f96c5ea63280688ac1841b0a?d=identicon)[gmanricks](/maintainers/gmanricks)

---

Top Contributors

[![gmanricks](https://avatars.githubusercontent.com/u/1296664?v=4)](https://github.com/gmanricks "gmanricks (20 commits)")

---

Tags

cligit

### Embed Badge

![Health badge](/badges/codestaq-phook/health.svg)

```
[![Health](https://phpackages.com/badges/codestaq-phook/health.svg)](https://phpackages.com/packages/codestaq-phook)
```

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[projektgopher/whisky

A simple CLI tool for managing a project's git hooks across multiple members.

241281.3k20](/packages/projektgopher-whisky)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
