PHPackages                             carrlabs/git-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. carrlabs/git-wrapper

AbandonedLibrary

carrlabs/git-wrapper
====================

A wrapper for the git command line executable, based on YiiGit (https://github.com/phpnode/YiiGit). Allows access to all git commands via a simple object oriented interface.

11.4k1PHP

Since Oct 3Pushed 12y ago1 watchersCompare

[ Source](https://github.com/CarrLabs/git-wrapper)[ Packagist](https://packagist.org/packages/carrlabs/git-wrapper)[ RSS](/packages/carrlabs-git-wrapper/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

#### Introduction

[](#introduction)

A wrapper for the git command line executable, based on [YiiGit](https://github.com/phpnode/YiiGit). Allows access to all git commands via a simple object oriented interface.

#### Usage examples

[](#usage-examples)

Add some files and folders to git

```
$repository = new \CarrLabs\GitWrapper\GitRepository('path/to/your/git/repo');
$repository->add('somefile.txt');
$repository->add('somedirectory');
```

Commit some files with git

```
$repository->commit('Added some files');
```

Checkout an existing branch

```
$repository->checkout('some-existing-branch');
echo $repository->getActiveBranch()->name; // some-existing-branch
```

Checkout a new branch

```
$repository->checkout('some-new-branch', TRUE);
echo $repository->getActiveBranch()->name; // some-new-branch
```

List all branches

```
foreach($repository->getBranches() as $branch)
{
	echo $branch->name . "\n";
}
```

List all tags with metadata

```
foreach($repository->getTags() as $tag)
{
	echo $tag->name . "\n";
	echo $tag->getAuthorName() . "\n";
	echo $tag->getAuthorEmail() . "\n";
	echo $tag->getMessage() . "\n";
}
```

List all the commits on the current branch

```
foreach($repository->getActiveBranch()->getCommits() as $commit)
{
	echo $commit->getAuthorName() . ' at ' . $commit->getTime() . "\n";
	echo $commit->getMessage() . "\n";
	echo str_repeat('-', 50) . "\n";
}
```

List all the files affected by the latest commit

```
foreach($repository->getActiveBranch()->getLastCommit()->getFiles() as $file)
{
	echo $file . "\n";
}
```

Check if a tag exists on the default remote ('origin')

```
$repository->getRemote()->hasTag('myTag');
```

List all branches on a remote repository called 'upstream'

```
foreach($repository->getRemote('upstream')->getBranches() as $branch)
{
	echo $branch . "\n";
}
```

#### API

[](#api)

\\CarrLabs\\GitWrapper\\GitRepository

```
setPath($path, $createIfEmpty = false, $initialize = false)
getPath()
run($command)
add($file)
rm($file, $force = false)
commit($message = null, $addFiles = false, $amend = false)
status()
describe($options = '')
checkout($branchName, $create = false, $force = false)
clean($deleteDirectories = false, $force = false)
cloneTo($targetDirectory)
cloneFrom($targetDirectory)
cloneRemote($sourceUrl)
push($remote, $branch = "master", $force = false)
fetch($repository)
getActiveBranch()
getBranches()
hasBranch($branch)
createBranch($branchName)
deleteBranch($branchName, $force = false)
getCommit($hash)
getTags()
getTag($name)
hasTag($tag)
addTag($name, $message, $hash = null)
removeTag($tag)
getRemotes()
getRemote($remote = null)
hasCommit($hash)
```

\\CarrLabs\\GitWrapper\\GitCommit

```
getAuthorName()
getAuthorEmail()
getTime()
getSubject()
getMessage()
getNotes()
getParents()
getFiles()
```

\\CarrLabs\\GitWrapper\\GitBranch

```
getCommits()
getCommit($hash)
getLastCommit()
```

\\CarrLabs\\GitWrapper\\GitTag

```
push($remote = null)
getAuthorName()
getAuthorEmail()
getMessage()
getCommit()
```

\\CarrLabs\\GitWrapper\\GitRemote

```
getBranches()
hasBranch($branch)
deleteBranch($branchName)
getTags()
hasTag($tag)
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cfd91b0cf359cfbab1dfee6786404558252f8c759692b4237aac57dac441be0?d=identicon)[BrentGoldthwaite](/maintainers/BrentGoldthwaite)

---

Top Contributors

[![BrentGoldthwaite](https://avatars.githubusercontent.com/u/1382794?v=4)](https://github.com/BrentGoldthwaite "BrentGoldthwaite (2 commits)")

### Embed Badge

![Health badge](/badges/carrlabs-git-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/carrlabs-git-wrapper/health.svg)](https://phpackages.com/packages/carrlabs-git-wrapper)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
