Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Git State Laravel Package

sebastian/git-state

Describe the state of a Git checkout from PHP. Detect origin URL, current branch and commit hash, and whether the working directory is clean; otherwise return the git status output. Useful for build metadata and diagnostics.

View on GitHub
Deep Wiki
Context7

Latest Stable Version CI Status codecov

sebastian/git-state

Library for describing the state of a Git checkout.

Installation

You can add this library as a local, per-project dependency to your project using Composer:

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

test.php

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
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4