PHPackages                             sebastian/git-state - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. sebastian/git-state

ActiveLibrary[Testing &amp; Quality](/categories/testing)

sebastian/git-state
===================

Library for describing the state of a Git checkout

1.0.0(1mo ago)016.1k—0%BSD-3-ClausePHPPHP &gt;=8.4CI passing

Since Mar 21Pushed 1mo agoCompare

[ Source](https://github.com/sebastianbergmann/git-state)[ Packagist](https://packagist.org/packages/sebastian/git-state)[ Docs](https://github.com/sebastianbergmann/git-state)[ GitHub Sponsors](https://github.com/sebastianbergmann)[ Fund](https://liberapay.com/sebastianbergmann)[ RSS](/packages/sebastian-git-state/feed)WikiDiscussions main Synced 1mo ago

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

[![Latest Stable Version](https://camo.githubusercontent.com/56d9d77280aea2338669646a71ec4c5b2bb7a07bfa1137f88ad866f69cee5fbc/68747470733a2f2f706f7365722e707567782e6f72672f73656261737469616e2f6769742d73746174652f76)](https://packagist.org/packages/sebastian/git-state)[![CI Status](https://github.com/sebastianbergmann/git-state/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/git-state/actions)[![codecov](https://camo.githubusercontent.com/fd0399f60bebc1d86d3cacb3f193d722deb45a16811fcd089d0bc986a6b70680/68747470733a2f2f636f6465636f762e696f2f67682f73656261737469616e626572676d616e6e2f6769742d73746174652f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/sebastianbergmann/git-state)

sebastian/git-state
===================

[](#sebastiangit-state)

Library for describing the state of a Git checkout.

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

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):

```
composer require sebastian/git-state

```

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

```
composer require --dev sebastian/git-state

```

Usage
-----

[](#usage)

#### `test.php`

[](#testphp)

```
use SebastianBergmann\GitState\Builder;

$builder = new Builder;
$state   = $builder->build();

if ($state === false) {
    // Not a Git repository or no origin remote configured
    exit(1);
}

print $state->originUrl() . PHP_EOL;
print $state->branch() . PHP_EOL;
print $state->commit() . PHP_EOL;

if ($state->isClean()) {
    print 'Working directory is clean' . PHP_EOL;
} else {
    print $state->status() . PHP_EOL;
}
```

```
github.com:sebastianbergmann/git-state.git
main
ab00820c3757dbd30a8caa185aa4515b98713238
M README.md
?? test.php

```

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance90

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

49d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1089?v=4)[Sebastian Probst Eide](/maintainers/sebastian)[@sebastian](https://github.com/sebastian)

---

Top Contributors

[![sebastianbergmann](https://avatars.githubusercontent.com/u/25218?v=4)](https://github.com/sebastianbergmann "sebastianbergmann (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sebastian-git-state/health.svg)

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

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

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