sebastian/git-state
PHP library to describe the state of a Git checkout. Retrieve origin URL, current branch and commit hash, and determine whether the working directory is clean or get a git-style status output. Useful for build/test tooling and CI metadata.
main or release/* branches).feature/x with 3 uncommitted changes—commit or stash?").Use this when:
Look elsewhere when:
exec() or Process facade.gitpython for Python, jgit for Java).For Executives: "This package enables us to programmatically inspect Git state—like branch, commit hash, and working directory status—to automate critical workflows such as deployment validation, feature flagging, and security checks. It’s a lightweight, open-source solution that reduces manual errors and improves reliability without adding complexity. Since it’s maintained by the creator of PHPUnit, it’s stable and low-risk. For example, we could use it to block deployments with uncommitted changes or dynamically enable features based on the commit history."
For Engineering/DevOps: *"Need to check Git state in Laravel? This package gives you a clean, dependency-free way to access:
sebastian/git-state) and works alongside existing Git tools. Perfect for quick scripts, CI checks, or scaling to pipeline automation. No bloat—just Git metadata when you need it."*For Developers: *"Want to validate Git state in your Laravel app? This package lets you:
$state = (new \SebastianBergmann\GitState\Builder())->build();
if (!$state->isClean()) {
throw new \RuntimeException('Dirty working directory!');
}
No external dependencies, no Git library bloat—just what you need."*
How can I help you explore Laravel packages today?