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(3mo ago)122.6M↑15182.3%[1 issues](https://github.com/sebastianbergmann/git-state/issues)2BSD-3-ClausePHPPHP &gt;=8.4CI passing

Since Mar 21Pushed 3w 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 3w ago

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

[![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

55

—

FairBetter than 97% of packages

Maintenance87

Actively maintained with recent releases

Popularity50

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.8% 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

95d 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 (31 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (11 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

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M340](/packages/dms-phpunit-arraysubset-asserts)[orchestra/workbench

Workbench Companion for Laravel Packages Development

8219.1M69](/packages/orchestra-workbench)

PHPackages © 2026

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