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-11-06 21:10:12 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;
}