---
title: "Feature detection — Git for Laravel | Roundly"
description: "Check what each provider supports before calling it, read the full capability matrix, and compare GitHub, GitLab and Bitbucket side by side."
url: https://roundly-consulting.com/open-source/docs/git-for-laravel/feature-detection
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Git for Laravel](https://roundly-consulting.com/open-source/docs/git-for-laravel.md)

# Feature detection

Branch on the capability matrix instead of catching FeatureNotSupportedException:

```php
use RoundlyConsulting\Git\Enums\Feature;
use RoundlyConsulting\Git\Enums\ProviderName;

$github = Git::github();

if ($github->supports(Feature::ListCommits)) {
    $github->repo('acme/api')->commits()->get();
}

$github->supportsAll(Feature::CreateRelease, Feature::CreateTag); // bool
$github->supportsAny(Feature::Languages);                         // bool
$github->features();                                              // list<Feature> this provider supports
$github->capabilities();                                          // ['repositories' => true, ...]
$github->featureMatrix();                                         // list<FeatureInfo> with ->supported
Git::capabilities(ProviderName::Bitbucket);                       // without authenticating
Feature::MergePullRequest->description();                         // "Merge a pull/merge request."
```

## Capability matrix

| Feature | GitHub | GitLab | Bitbucket |
| --- | --- | --- | --- |
| `ListRepositories, FindRepository, ListCommits, FindCommit, ListRepositoryBranches, FindBranch` | Yes | Yes | Yes |
| `ListPullRequests, FindPullRequest` | Yes | Yes | Yes |
| `ListIssues, FindIssue` | Yes | Yes | No |
| `ListTags, ListReleases, FindRelease` | Yes | Yes | No |
| `FileContents, Compare, ListContributors, Languages, SearchRepositories` | Yes | Yes | No |
| `CreateRepository` | Yes | Yes | Yes |
| `GenerateFromTemplate` | Yes | No | No |
| `CreateBranch, CreateFile, UpdateFile` | Yes | Yes | No |
| `CreatePullRequest, CreateComment` | Yes | Yes | Yes |
| `ClosePullRequest, ApprovePullRequest, ReviewPullRequest, ListPullRequestReviews, MergePullRequest` | Yes | No | No |
| `CreateRelease, CreateTag` | Yes | Yes | No |
| `CreateWebhook, DeleteWebhook, ListWebhooks` | Yes | Yes | Yes |
| `FindInstallation, ListInstallations, ListInstallationRepositories` | Yes | No | No |
| `RepositoryActivity` | Yes | No | No |
| `DispatchWorkflow, ListWorkflowRuns, FindWorkflowRun, ListWorkflowJobs, CancelWorkflowRun` | Yes | No | No |

Git::capabilities() answers without authenticating, so you can render a provider picker before a user has connected anything.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/git-for-laravel.md)
