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
$repo->getCommitersList()
// branches list
$repo->getBranchesList()
// commits list
$repo->getCommitsList()
// current branch
$repo->getCurrentBranch()
// description
$repo->getDescription()
// tags list
$repo->getTagsList()
// last commit infos
$repo->getLastCommitInfos()
// tree
$repo->getTree()
// tree for first dir
$repo->getTree('HEAD', $first_dir)
// files info
$repo->getFilesInfo()
// recursive tree
$repo->getRecursiveTree()
// commits history
$repo->getCommitsHistory()
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.
GIT API
Copyright (c) 2013-2016 Pierre Cassat and contributors
Licensed under the Apache 2.0 license.
Les Ateliers Pierrot - Paris, France