PHPackages                             aybarsm/laravel-git - 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. aybarsm/laravel-git

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

aybarsm/laravel-git
===================

An intuitive service provider for Laravel and Laravel Zero, streamlining Git repository management both within and outside your application.

v1.0.3(2y ago)161MITPHPPHP ^8.1

Since Sep 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aybarsm/laravel-git)[ Packagist](https://packagist.org/packages/aybarsm/laravel-git)[ Docs](https://github.com/aybarsm/laravel-git)[ RSS](/packages/aybarsm-laravel-git/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (5)Used By (0)

What It Does
------------

[](#what-it-does)

This package is crafted for both Laravel and Laravel Zero developers aiming to integrate and manage Git repositories seamlessly within their applications. Whether you're looking to control a repository residing within your application or interact with external ones, this service provider simplifies those interactions. Built on the foundation of Laravel's service container, it provides a straightforward and efficient approach to manage your Git operations, keeping your application connected and in sync with your versioning needs.

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

[](#installation)

You can install the package via composer:

```
composer require aybarsm/laravel-git
```

You can publish the config file by:

```
php artisan vendor:publish --provider="Aybarsm\Laravel\Git\GitServiceProvider" --tag=config
```

Configure Git Provider
----------------------

[](#configure-git-provider)

You can change the concretes by extending the classes, remove or add new repos and modify commands with subcommands.

##### Note: The list of the commands only covers the commands with subcommands. Almost all git command has been implemented to the concrete and interface in the package.

[](#note-the-list-of-the-commands-only-covers-the-commands-with-subcommands-almost-all-git-command-has-been-implemented-to-the-concrete-and-interface-in-the-package)

```
return [
    'repos' => [
        'default' => base_path(),
    ],
    'concretes' => [
        'Git' => \Aybarsm\Laravel\Git\Git::class,
        'GitRepo' => \Aybarsm\Laravel\Git\GitRepo::class,
    ],
    'commands' => [
        'bisect' => [
            'subcommands' => ['start', 'bad', 'new', 'good', 'old', 'terms', 'skip', 'reset', 'visualize', 'view', 'replay', 'log', 'run'],
        ],
        'bundle' => [
            'subcommands' => ['create', 'verify', 'list-heads', 'unbundle'],
        ],
        'maintenance' => [
            'subcommands' => ['run', 'start', 'stop', 'register', 'unregister'],
        ],
        'notes' => [
            'subcommands' => ['list', 'add', 'copy', 'append', 'edit', 'show', 'merge', 'remove', 'prune', 'get-ref'],
        ],
        'sparse-checkout' => [
            'subcommands' => ['init', 'list', 'set', 'add', 'reapply', 'disable', 'check-rules'],
        ],
        'stash' => [
            'subcommands' => ['list', 'show', 'drop', 'pop', 'apply', 'branch', 'push', 'save', 'clear', 'create', 'store'],
        ],
        'submodule' => [
            'subcommand_prefixes' => ['--quiet'],
            'subcommands' => ['add', 'status', 'init', 'deinit', 'update', 'set-branch', 'set-url', 'summary', 'foreach', 'sync', 'absorbgitdirs'],
        ],
        'worktree' => [
            'subcommands' => ['add', 'list', 'lock', 'move', 'prune', 'remove', 'repair', 'unlock'],
        ],
        'reflog' => [
            'subcommands' => ['show', 'expire', 'delete', 'exists'],
        ],
        'remote' => [
            'subcommands' => ['add', 'rename', 'remove', 'set-head', 'set-branches', 'get-url', 'set-url', 'show', 'prune', 'update'],
        ],
        'p4' => [
            'subcommands' => ['clone', 'sync', 'rebase', 'submit'],
        ],
        'commit-graph' => [
            'subcommands' => ['verify', 'write'],
        ],
        'credential' => [
            'subcommands' => ['fill', 'approve', 'reject'],
        ],
        'hook' => [
            'subcommands' => ['run'],
        ],
    ],
];
```

Usage
-----

[](#usage)

You can call the concrete Git by either Git::class Facade or with helper function git(). Another helper function of gitRepo($repoName) has also implemented to directly call pre-defined Git Repos.

### Example

[](#example)

```
use Aybarsm\Laravel\Support\Enums\ProcessReturnType;

$git = git();
$repo = $git->repo(); // Returns the default pre-defined repo
// or you can directly reach the repo
// $repo = gitRepo('default');

if ($repo->isReady() && $repo->isDirty()){
    // arguments accepts strings or cli type arrays like arg, --arg=value, -arg value or -arg
    $repo->commit(
    args: [
        '-a',
        '-m' => '"v1.0.0"'
        ]
    )
    // Git and GitRepo concretes are already uses Laravel's Conditionable trait however chaining made easier with pre-defined whenSuccessful and whenFailed methods.
    ->whenSuccessful(
        callback: fn ($repoInstance) => $repoInstance->tag('v1.0.0'),
        default: function ($repoInstance) {
                Log::info('Git Repo Command Error', (array)$repoInstance->result(ProcessReturnType::ALL_OUTPUT));
                return $repoInstance;
            }
    )
    ->whenSuccessful(
        callback: fn ($repoInstance) => $repoInstance->push('origin v1.0.0'),
        default: function ($repoInstance) {
                Log::info('Git Repo Command Error', (array)$repoInstance->result(ProcessReturnType::ALL_OUTPUT));
                return $repoInstance;
            }
    );
}

// You can easily create individual GitRepo instances by
$newRepo = GitRepo::make('someName', '/some/path');
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

4

Last Release

980d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a901a2a04b1c83112cfa51337f2a0e13ab4b3182bfe1bf2ab3471881810d9ccd?d=identicon)[aybarsm](/maintainers/aybarsm)

---

Top Contributors

[![aybarsm](https://avatars.githubusercontent.com/u/39916128?v=4)](https://github.com/aybarsm "aybarsm (11 commits)")

---

Tags

laravelgitmanagementmixinsaybarsmsubmodule

###  Code Quality

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aybarsm-laravel-git/health.svg)

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

###  Alternatives

[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[tonysm/importmap-laravel

Use ESM with importmap to manage modern JavaScript in Laravel without transpiling or bundling.

148399.8k1](/packages/tonysm-importmap-laravel)[bensampo/laravel-embed

Painless responsive embeds for videos, slideshows and more.

142146.8k](/packages/bensampo-laravel-embed)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[laracraft-tech/laravel-useful-additions

A collection of useful Laravel additions!

58109.4k](/packages/laracraft-tech-laravel-useful-additions)[watson/nameable

Format names of users into full, familiar and abbreviated forms

299.7k](/packages/watson-nameable)

PHPackages © 2026

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