Looking to hire Laravel developers? Try LaraJobs
This package is not available.

git-for-laravel maintained by roundly-consulting

Description
Access git repositories (GitHub, GitLab, Bitbucket) through a single Laravel-native API.
Last update
2026/10/11 08:57 (dev-main)
License
Downloads
24

Comments
comments powered by Disqus

Git for Laravel

One Laravel-native API for GitHub, GitLab and Bitbucket: page through repositories and commits, read pull requests, issues, releases and files, open and merge pull requests, receive signed webhooks as typed events, and authenticate with tokens, GitHub Apps or OAuth — every answer a typed, provider-agnostic data object.

Installation

Requires PHP 8.4, Laravel 12 or 13.

composer require roundly-consulting/git-for-laravel

Put an access token in .env (GITHUB_TOKEN, GITLAB_TOKEN or BITBUCKET_TOKEN); without one, only public repositories can be read.

Usage

Pick a forge and scope it to one repository:

use RoundlyConsulting\Git\Facades\Git;

$repo = Git::github()->repo('acme/app');       // or Git::gitlab(), Git::bitbucket()

$repo->get()->defaultBranch;                   // "main"
$repo->pullRequests('open');                   // Page<PullRequest>
$repo->contents('composer.json')->content;     // decoded file contents

foreach ($repo->commits()->branch('main')->since(now()->subWeek())->lazy() as $commit) {
    $commit->sha;                              // streams across every page
}

Writes take typed input objects:

use RoundlyConsulting\Git\Dto\Input\{NewBranch, NewFile, NewPullRequest};
use RoundlyConsulting\Git\Enums\MergeMethod;

$repo->createBranch(new NewBranch('feature/ci', 'main'));
$repo->createFile(new NewFile('ci.yml', $yaml, 'Add CI', 'feature/ci'));

$pr = $repo->createPullRequest(new NewPullRequest('Add CI', 'feature/ci', 'main'));

$repo->pullRequest($pr->number)->comment('Ready to ship');
$repo->pullRequest($pr->number)->merge(MergeMethod::Squash); // the merge commit's sha

Documentation

The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/git-for-laravel

Release notes are in CHANGELOG.md. To contribute, see the contributing guide.

Support our work

This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.

License

The MIT License (MIT). See LICENSE.md.