sweetchuck/git-hooks-stdinput-reader

Read and parse the StdInput of Git hooks

v0.1.0 2019-12-31 19:21 UTC

This package is auto-updated.

Last update: 2024-12-17 19:03:33 UTC


README

CircleCI codecov

Supported Git hooks

Usage

.git/hooks/pre-receive

#!/usr/bin/env php
<?php

use Sweetchuck\GitHooksStdInputReader\PreReceiveReader;

$reader = new PreReceiveReader(STDIN);

foreach ($reader as $item) {
    echo 'Old value: ', $item->oldValue, PHP_EOL;
    echo 'New value: ', $item->newValue, PHP_EOL;
    echo 'Ref name:  ', $item->refName, PHP_EOL;
    echo '-----------', PHP_EOL;
}