Skip to content
Library for accessing Git repositories with PHP
PHP Shell
Branch: master
Clone or download
Latest commit b4620be Dec 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github Updated docs (#158) Dec 13, 2019
src/Gitonomy/Git Apply fixes from StyleCI (#145) Jul 3, 2019
tests Enhance exception tests (#148) Oct 25, 2019
.gitattributes CS Fixes And Minor Tweaks Nov 24, 2014
.gitignore CS Fixes And Minor Tweaks Nov 24, 2014
.travis.yml Test on PHP 7.4 and all Symfony vesions (#155) Dec 3, 2019
LICENSE Initial commit Sep 6, 2012 Update Dec 13, 2019
composer.json Update documentation (#157) Dec 13, 2019
phpunit.xml.dist Allow PHPUnit 7 (#149) Oct 25, 2019 script to test against different git version (fixes #22) Feb 2, 2013

Gitlib for Gitonomy

Build Status StyleCI License

This library provides methods to access Git repository from PHP 5.6 or 7.

It makes shell calls, which makes it less performant than any solution.

Anyway, it's convenient and don't need to build anything to use it. That's how we love it.

Quick Start

You can install gitlib using Composer. Simply require the version you need:

$ composer require gitonomy/gitlib

or edit your composer.json file by hand:

    "require": {
        "gitonomy/gitlib": "^1.2"

Example Usage


use Gitonomy\Git\Repository;

$repository = new Repository('/path/to/repository');

foreach ($repository->getReferences()->getBranches() as $branch) {
    echo '- '.$branch->getName().PHP_EOL;

$repository->run('fetch', ['--all']);

API Documentation

For Enterprise

Available as part of the Tidelift Subscription

The maintainers of gitonomy/gitlib and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

You can’t perform that action at this time.