A PHP API to get infos and manage a GIT distant or local repository

v1.1.0 2015-03-04 21:58 UTC


demonstration documentation A PHP API to get infos and manage a GIT distant or local repository.


Working with a local repository clone:

// open a repo
$local_repo = ~/repositories/git-api
$repo = \GitApi\GitApi::open($local_repo)

// commiters list

// branches list

// commits list

// current branch

// description

// tags list

// last commit infos

// tree

// tree for first dir
$repo->getTree('HEAD', $first_dir)

// files info

// recursive tree

// commits history

Working with a distant repository URL will create a local clone:

// create a clone of a distant repo in a local dir
// if the local clone already exists, a `git pull` will be processed on it
$distant_repo = https://github.com/atelierspierrot/git-api
$local_repo = ~/repositories/git-api
$repo = \GitApi\GitApi::create($local_repo, $distant_repo)

// ... same as above


For a complete information about how to install this package and load its namespace, please have a look at our USAGE documentation.

If you are a Composer user, just add the package to the requirements of your project's composer.json manifest file:

"atelierspierrot/git-api": "@stable"

You can use a specific release or the latest release of a major version using the appropriate version constraint.

Please note that this package depends on the externals PHP Patterns and PHP Library.

Author & License



Copyright (c) 2013-2016 Pierre Cassat and contributors

Licensed under the Apache 2.0 license.


Les Ateliers Pierrot - Paris, France

http://www.ateliers-pierrot.fr/ - contact@ateliers-pierrot.fr