patrikx3 / gitter
Gitter interacts with Git repositories with the latest version dependencies and PHP.
Installs: 2 294
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 64
Open Issues: 0
Requires
- php: >=7.1.0
- danielstjules/stringy: >=3
- spatie/temporary-directory: ^1.1
- symfony/process: >=4
Requires (Dev)
- mockery/mockery: >=1
- phpunit/phpunit: >=7
- symfony/filesystem: >=4
README
This is Klaus Silveira's fork, with sub-modules.
PHP 7 only
Gitter allows you to interact in an object oriented manner with Git repositories
via PHP. The main goal of the library is not to replace the system git
command,
but provide a coherent, stable and performatic object oriented interface.
Most commands are sent to the system's git
command, parsed and then interpreted
by Gitter. Everything is transparent to you, so you don't have to worry about a thing.
Releases
In progress
- In submodules, if the "submodule" and "path" is not the same, it chokes (it should work the submodule name and path are not the same)
- Works
- submodule "path/name"
- path path/name
- Not working
- submodule "name"
- path path/name
- Works
Change log ...
Requirements
- git (http://git-scm.com) (tested with 1.7.5.4)
Usage
Gitter is very easy to use and you'll just need a few method calls to get started. For example, to create a new repository:
$client = new Gitter\Client;
$repository = $client->createRepository('/home/user/test');
Or a bare repository:
$client = new Gitter\Client;
$repository = $client->createRepository('/home/user/test', true);
Or to open an existing repository:
$client = new Gitter\Client;
$repository = $client->getRepository('/home/user/anothertest');
Both methods will return a Repository
object, which has various methods
that allow you to interact with that repository.
Getting a list of commits
Once you get hold of the Repository
object, you can use:
$commits = $repository->getCommits();
print_r($commits);
To get a list of various commits.
Getting a single commit
Given a specific commit hash, you can find information about that commit:
$commit = $repository->getCommit('920be98a05');
print_r($commit);
Getting statistics for repository
Statistics aggregators can be added to the repository:
$repository->addStatistics(array(
new Gitter\Statistics\Contributors,
new Gitter\Statistics\Date,
new Gitter\Statistics\Day,
new Gitter\Statistics\Hour
));
print_r($repository->getStatistics());