Fork me on GitHub

Git.php

A PHP git library

Description

A PHP git repository control library. Allows the running of any git command from a PHP class. Runs git commands using proc_open, not exec or the type, therefore it can run in PHP safe mode.

Examples

<?php

require_once "Git.php";

// open a repository
$repo = Git::open('/path/to/repo');   // or, new GitRepo(...);

// `git add *`
$repo->add('*');

// `git commit -av -m 'added files'`
$repo->commit('added files');

// add a new remote
$repo->run('remote add origin git@github.com:kbjr/repo-name');

// push out
$repo->run('push origin master');

?>