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

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

ibrostudio/laravel-git
======================

Manage git repositories with Laravel

2.2.0(10mo ago)0151MITPHPPHP ^8.4

Since Oct 2Pushed 10mo ago1 watchersCompare

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

READMEChangelog (8)Dependencies (19)Versions (9)Used By (1)

Laravel Git
===========

[](#laravel-git)

A powerful Laravel package for managing Git repositories with an elegant, fluent API. This package provides a seamless integration between Laravel applications and Git repositories, allowing you to perform Git operations programmatically.

Presentation and Goal
---------------------

[](#presentation-and-goal)

Laravel Git is designed to simplify Git operations in Laravel applications. It provides a clean, object-oriented interface to interact with Git repositories, making it easy to:

- Create, clone, and manage Git repositories
- Perform common Git operations (pull, push, fetch, commit)
- Work with branches, tags, and releases
- Integrate with GitHub (and potentially other Git providers in the future)
- Generate changelogs and manage versioning

The goal of this package is to provide a robust, Laravel-friendly way to interact with Git repositories, whether for deployment automation, version control management, or other Git-related tasks in your Laravel applications.

Requirements
------------

[](#requirements)

- PHP ^8.4
- Laravel 12
- Git

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

[](#installation)

You can install the package via Composer:

```
composer require ibrostudio/laravel-git
```

The package will automatically register its service provider.

Configuration
-------------

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --provider="IBroStudio\Git\GitServiceProvider"
```

This will create a `config/git.php` file where you can configure:

- Default Git provider, branch, and remote
- Authentication credentials for Git providers (GitHub)
- Repository templates
- Changelog configuration
- Pre-commit hooks
- Scripts for deployment, formatting, and testing

### GitHub Authentication

[](#github-authentication)

To use GitHub integration, set your GitHub credentials in your `.env` file:

```
GITHUB_USERNAME=your-github-username
GITHUB_TOKEN=your-github-personal-access-token

```

Basic Usage
-----------

[](#basic-usage)

### Opening an Existing Repository

[](#opening-an-existing-repository)

```
use IBroStudio\Git\Repository;

// Open a repository from a local path
$repository = Repository::open('/path/to/repository');
```

### Cloning a Repository

[](#cloning-a-repository)

```
use IBroStudio\Git\Repository;

// Clone a repository
$repository = Repository::clone(
    url: 'git@github.com:username/repository.git',
    localParentDirectoryPath: '/path/to/parent/directory'
);
```

### Creating a New Repository

[](#creating-a-new-repository)

```
use IBroStudio\Git\Repository;

$repository = Repository::init([
    'name' => 'new-repository',
    'localParentDirectory' => '/path/to/parent/directory',
]);
```

This will use all default values from git.php config file.

You can define more parameters and overwrite default values:

```
use IBroStudio\Git\Repository;
use IBroStudio\DataObjects\Enums\GitProvidersEnum;
use IBroStudio\Git\Dto\OwnerDto\AuthOwnerDto;
use IBroStudio\Git\Dto\RepositoryDto\ConfigDto\RemoteDto;
use IBroStudio\DataObjects\ValueObjects\GitSshUrl;
use IBroStudio\Git\Enums\GitRepositoryVisibilitiesEnum;

$repository = Repository::init([
    'name' => 'new-repository',
    'branch' => 'main',
    'owner' => AuthOwnerDto::from(['name' => 'your-github-username']),
    'provider' => GitProvidersEnum::GITHUB,
    'remote' => RemoteDto::from([
        'name' => 'origin',
        'url' => GitSshUrl::build(GitProvidersEnum::GITHUB, 'your-github-username', 'new-repository'),
    ]),
    'localParentDirectory' => '/path/to/parent/directory',
    'visibility' => GitRepositoryVisibilitiesEnum::PRIVATE,
]);
```

### Basic Git Operations

[](#basic-git-operations)

```
// Check repository status
$status = $repository->status();
$hasChanges = $repository->hasChanges();

// Fetch, pull, and push
$repository->fetch();
$repository->pull();
$repository->push();

// Restore changes
$repository->restore();
```

### Working with Commits

[](#working-with-commits)

```
// Get the last commit
$lastCommit = $repository->commits()->last();

// Get commit history
$history = $repository->commits()->history();

// Create a new commit
use IBroStudio\Git\Dto\RepositoryDto\CommitDto;

$commit = CommitDto::from([
    'message' => 'Your commit message',
    'description' => 'Optional longer description',
]);

$repository->commits()->add($commit);

// Undo the last commit
$repository->commits()->undo();
```

Advanced Usage
--------------

[](#advanced-usage)

### Working with Branches

[](#working-with-branches)

```
// Create a new branch
$repository->branches()->create('feature/new-feature');

// Switch to a branch
$repository->branches()->checkout('feature/new-feature');

// Merge branches
$repository->branches()->merge('feature/new-feature', 'main');
```

### Working with Tags and Releases

[](#working-with-tags-and-releases)

```
// Create a tag
$repository->tags()->create('v1.0.0');

// Create a release
use IBroStudio\Git\Dto\RepositoryDto\ReleaseDto;

$release = ReleaseDto::from([
    'tag' => 'v1.0.0',
    'name' => 'Version 1.0.0',
    'description' => 'Release notes for version 1.0.0',
]);

$repository->releases()->create($release);
```

### Generating Changelogs

[](#generating-changelogs)

```
$repository->changelog()->generate();
```

API Documentation
-----------------

[](#api-documentation)

The package provides several main classes and interfaces:

- `Git`: The main facade for interacting with Git providers
- `Repository`: Represents a Git repository with methods for common operations
- `Commit`: Represents a Git commit
- `Branch`: Represents a Git branch
- `Tag`: Represents a Git tag
- `Release`: Represents a Git release

Each class provides a fluent interface for performing operations related to its domain.

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance54

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~40 days

Recently: every ~70 days

Total

8

Last Release

310d ago

Major Versions

1.1.2 → 2.0.02025-06-28

PHP version history (2 changes)1.0.0PHP ^8.3

2.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a456dae716df4be38cb7d5f02ca522a02ec37eda586ab0cae0f504516b7c1ef?d=identicon)[iBroStudio](/maintainers/iBroStudio)

---

Top Contributors

[![Yann-iBroStudio](https://avatars.githubusercontent.com/u/2676572?v=4)](https://github.com/Yann-iBroStudio "Yann-iBroStudio (16 commits)")

---

Tags

laravelgitiBroStudio

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

106.1k](/packages/codebar-ag-laravel-zammad)

PHPackages © 2026

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