Search by

roundly-consulting / git-for-laravel

mihaliak

Access git repositories (GitHub, GitLab, Bitbucket) through a single Laravel-native API.

Package info

github.com/roundly-consulting/git-for-laravel

pkg:composer/roundly-consulting/git-for-laravel

Fund package maintenance!

Patreon

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-10-03 18:13 UTC

This package is auto-updated.

Last update: 2026-10-03 18:34:51 UTC


README

Git for Laravel — Roundly open source

Latest release Tests Code style Donate Patreon Crypto

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.

Donate to Roundly open source Become a patron on Patreon Donate crypto: BTC, ETH, BNB or SOL

License

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