PHPackages                             lotharthesavior/branch - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lotharthesavior/branch

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lotharthesavior/branch
======================

PHP library for manipulations on git repository. Based on coyl/Git.php and it's forks

2.0.0(3y ago)32991MITPHPPHP ^8.1CI failing

Since Apr 7Pushed 3y agoCompare

[ Source](https://github.com/lotharthesavior/branch)[ Packagist](https://packagist.org/packages/lotharthesavior/branch)[ Docs](https://github.com/lotharthesavior/branch)[ RSS](/packages/lotharthesavior-branch/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (2)Versions (19)Used By (1)

[![Branch Logo](img/branch-logo.png)](img/branch-logo.png)

[![Tests](https://github.com/lotharthesavior/branch/actions/workflows/php.yml/badge.svg)](https://github.com/lotharthesavior/branch/actions/workflows/php.yml)

Branch
======

[](#branch)

Branch is a PHP Git library based on kbjr/Git.php

Description
-----------

[](#description)

Branch is 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.

Requirements
------------

[](#requirements)

A system with [git](http://git-scm.com/) installed

Installation
------------

[](#installation)

To install via composer, you can simply run:

```
composer require lotharthesavior/branch
```

Basic Use
---------

[](#basic-use)

### Open Repository

[](#open-repository)

```
$console = new Console;
$repo = Git::open($console, '/path/to/repo'); // GitRepo
```

### Create Repository

[](#create-repository)

```
$console = new Console;
$repo = Git::create($console, '/path/to/repo'); // GitRepo
```

### Stage Changes

[](#stage-changes)

```
$repo->add('.');
```

### Commit

[](#commit)

```
$repo->commit('Some commit message');
```

### Clone

[](#clone)

```
$localPath = 'local-repo';
$repo = 'repo-url';
$repo->clone( $repo, $localPath );
```

### Push

[](#push)

```
$repo->push('origin', 'master');
```

### Branches

[](#branches)

#### Create

[](#create)

```
$repo->branchNew( 'name-for-the-branch' );
```

#### Get

[](#get)

```
$repo->branchGet(); // array
```

#### Get Active Branch

[](#get-active-branch)

```
// Git\GitRepo;
$repo;

$repo->getActiveBranch(); // string
```

### Remotes

[](#remotes)

#### Get

[](#get-1)

```
$repo->remote(); // \Git\DTO\Remote[]
```

#### Add

[](#add)

```
$name = 'name';
$address = 'url';
$type = '(fetch)';
$remote = new Remote($name, $address, $type);
$repo->remoteAdd($remote);
```

#### Push

[](#push-1)

```
$branch = new Branch('master');
$remote = new Remote('name', 'url', '(push)');
$repo->push($remote, $branch);
```

#### Pull

[](#pull)

```
$branch = new Branch('master');
$remote = new Remote('name', 'url', '(fetch)');
$repo->pull($remote, $branch);
```

### Description

[](#description-1)

#### Set

[](#set)

```
$repo->setDescription( 'Some Description' );
```

#### Get

[](#get-2)

```
$repo->getDescription(); // string
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 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.

###  Release Activity

Cadence

Every ~162 days

Recently: every ~584 days

Total

18

Last Release

1338d ago

Major Versions

0.1.7 → 1.0.02019-10-27

1.0.1 → 2.0.02022-10-31

PHP version history (3 changes)0.1.5PHP &gt;=5.4

1.0.0PHP &gt;=7.1

2.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1092909?v=4)[Sávio Resende](/maintainers/lotharthesavior)[@lotharthesavior](https://github.com/lotharthesavior)

---

Top Contributors

[![lotharthesavior](https://avatars.githubusercontent.com/u/1092909?v=4)](https://github.com/lotharthesavior "lotharthesavior (5 commits)")

---

Tags

gitphp-gitgit-client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lotharthesavior-branch/health.svg)

```
[![Health](https://phpackages.com/badges/lotharthesavior-branch/health.svg)](https://phpackages.com/packages/lotharthesavior-branch)
```

###  Alternatives

[czproject/git-php

Library for work with Git repository in PHP.

5555.1M102](/packages/czproject-git-php)[cypresslab/gitelephant

An abstraction layer for git written in PHP

6131.1M28](/packages/cypresslab-gitelephant)[teqneers/php-stream-wrapper-for-git

Git Stream Wrapper for PHP

2862.2M8](/packages/teqneers-php-stream-wrapper-for-git)[bruli/php-git-hooks

Git hooks for PHP projects.

669371.6k5](/packages/bruli-php-git-hooks)[marcocesarato/php-conventional-changelog

Generate changelogs and release notes from a project's commit messages and metadata and automate versioning with semver.org and conventionalcommits.org

2521.4M117](/packages/marcocesarato-php-conventional-changelog)[coyl/git

PHP library for manipulations on git repository. Based on kbjr/Git.php and it's forks

10208.0k4](/packages/coyl-git)

PHPackages © 2026

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