A beautiful, expressive GitHub commits management package built on top of conduit-ui/github-connector. Built with Taylor Otwell's design philosophy in mind - clean DTOs, fluent APIs, and minimal dependencies.
You can install the package via composer:
composer require conduit-ui/commitsuse ConduitUI\Commits\Facades\Commits;
// Get all commits for a repository
$commits = Commits::for('laravel/framework')->get();
// Get a single commit
$commit = Commits::find('laravel/framework', 'abc123');
// Compare two branches
$comparison = Commits::compare('laravel/framework', 'main', 'feature-branch');
// Compare between two commits
$comparison = Commits::between('laravel/framework', 'sha1', 'sha2');The package includes a powerful query builder for filtering commits:
use ConduitUI\Commits\Facades\Commits;
$commits = Commits::query()
->repository('laravel/framework')
->branch('main')
->author('taylorotwell')
->since('2025-01-01')
->until('2025-12-01')
->take(50)
->get();repository(string $repository)- Set the repository (required)branch(string $sha)- Filter by branch or SHAsha(string $sha)- Alias for branch()path(string $path)- Filter by file pathauthor(string $author)- Filter by commit authorcommitter(string $committer)- Filter by committersince(string $since)- Get commits after this dateuntil(string $until)- Get commits before this dateperPage(int $perPage)- Number of results per pagetake(int $count)- Alias for perPage()page(int $page)- Page number for paginationget()- Execute the query and return commitsfirst()- Get the first commit
$commit = Commits::find('laravel/framework', 'abc123');
// Access commit properties
$commit->sha; // Full SHA
$commit->shortSha(); // Short SHA (7 characters by default)
$commit->shortSha(10); // Custom length
$commit->message; // Commit message
$commit->author; // CommitAuthor DTO
$commit->committer; // CommitAuthor DTO
$commit->parents; // Array of parent SHAs
$commit->stats; // CommitStats DTO (if available)
$commit->files; // Collection of CommitFile DTOs
$commit->htmlUrl; // GitHub URL
$commit->commentsUrl; // Comments API URL
// Helper methods
$commit->hasFiles(); // Check if commit has file changes
$commit->hasStats(); // Check if commit has stats
$commit->isParent('sha'); // Check if SHA is a parent$author = $commit->author;
$author->name; // Author name
$author->email; // Author email
$author->date; // DateTimeImmutable objectforeach ($commit->files as $file) {
$file->filename; // File path
$file->status; // added, modified, removed, renamed
$file->additions; // Lines added
$file->deletions; // Lines deleted
$file->changes; // Total changes
$file->patch; // Git patch (if available)
$file->blobUrl; // Blob URL
$file->rawUrl; // Raw file URL
$file->contentsUrl; // Contents API URL
// Helper methods
$file->isAdded(); // Check if file was added
$file->isModified(); // Check if file was modified
$file->isRemoved(); // Check if file was removed
$file->isRenamed(); // Check if file was renamed
}$stats = $commit->stats;
$stats->additions; // Total lines added
$stats->deletions; // Total lines deleted
$stats->total; // Total changes$comparison = Commits::compare('laravel/framework', 'main', 'feature-branch');
// Access comparison properties
$comparison->aheadBy; // Commits ahead
$comparison->behindBy; // Commits behind
$comparison->status; // ahead, behind, diverged, identical
$comparison->commits; // Collection of Commit DTOs
$comparison->files; // Collection of CommitFile DTOs
$comparison->baseCommitSha; // Base commit SHA
$comparison->mergeBaseCommitSha;// Merge base commit SHA
$comparison->htmlUrl; // GitHub comparison URL
$comparison->permalinkUrl; // Permalink URL
$comparison->diffUrl; // Diff URL
$comparison->patchUrl; // Patch URL
// Helper methods
$comparison->isAhead(); // Check if ahead
$comparison->isBehind(); // Check if behind
$comparison->isDiverged(); // Check if diverged
$comparison->isIdentical(); // Check if identical
$comparison->totalChangedFiles(); // Count of changed files
$comparison->totalCommits(); // Count of commits$commits = Commits::query()
->repository('laravel/framework')
->author('taylorotwell')
->since('2025-01-01')
->until('2025-01-31')
->perPage(100)
->get();$commits = Commits::query()
->repository('laravel/framework')
->path('src/Illuminate/Database/Eloquent/Model.php')
->get();$commit = Commits::query()
->repository('laravel/framework')
->branch('11.x')
->first();$commits = Commits::for('laravel/framework')->get();
$totalAdditions = $commits->sum(fn ($commit) => $commit->stats?->additions ?? 0);
$totalDeletions = $commits->sum(fn ($commit) => $commit->stats?->deletions ?? 0);
echo "Total additions: {$totalAdditions}\n";
echo "Total deletions: {$totalDeletions}\n";The package uses readonly DTOs for all data structures:
Commit- Represents a Git commitCommitAuthor- Represents a commit author/committerCommitFile- Represents a file changed in a commitCommitStats- Represents commit statisticsCommitComparison- Represents a comparison between commits
All DTOs include:
fromArray(array $data): self- Create from arraytoArray(): array- Convert to array
Publish the configuration file:
php artisan vendor:publish --tag=commits-configThis will create a config/commits.php file:
return [
'default_repository' => env('COMMITS_DEFAULT_REPOSITORY'),
'default_per_page' => env('COMMITS_DEFAULT_PER_PAGE', 30),
];composer testcomposer formatcomposer analyseThe MIT License (MIT). Please see License File for more information.