graham-campbell/github
Laravel bridge to the KnpLabs PHP GitHub API. Provides a configurable GitHub client via a manager, with Laravel-friendly service container integration, facades, and multi-connection support for GitHub authentication and requests.
GitHubServiceProvider, GitHubManager). This reduces boilerplate and adheres to Laravel’s conventions (e.g., dependency injection, configuration publishing).Laravel-Manager, it supports multi-connection setups (e.g., GitHub::connection('alternative')), enabling modularity for environments like staging/production or per-tenant GitHub APIs.GitHub facade simplifies API calls (e.g., GitHub::me()->organizations()), abstracting the underlying KnpLabs/php-github-api client. This lowers the cognitive load for developers unfamiliar with the GitHub API.graham-campbell/bounded-cache) reduces API rate limits and improves performance for repetitive calls (e.g., fetching the same repo metadata).composer require graham-campbell/github) with automatic service provider registration (Laravel 5.5+). Manual registration is only needed for older Laravel versions or custom setups.application, jwt, none, private, token), accommodating OAuth apps, CI/CD pipelines, or personal access tokens. Configuration is published via php artisan vendor:publish, centralizing credentials.KnpLabs/php-github-api (v3.x), a mature, actively maintained library with comprehensive GitHub API coverage. Version pinning in composer.json mitigates risk.env() or a secrets manager). Hardcoding keys in config/github.php is discouraged..env for credentials and restrict file permissions.Cache::forget()).config/github.php if not needed or use graham-campbell/bounded-cache for TTL management.KnpLabs/php-github-api’s built-in retry logic) or upgrade to a GitHub Enterprise plan.php-github-api may deprecate endpoints. The package abstracts this but requires updates (e.g., v13.1 dropped PHP 8.0 support).token for CI/CD, application for OAuth apps)?.env, AWS Secrets Manager)?ETag/Last-Modified headers?403 Forbidden, 429 Too Many Requests)?Mockery or Vcr)?GitHubManager and GitHub facade, integrating with Laravel’s IoC container.config/github.php, aligning with Laravel’s config-first approach.GitHub::repo()->show()), reducing boilerplate for API calls.KnpLabs/php-github-api) supports all GitHub REST API v3 endpoints (e.g., repos, issues, actions). The package adds Laravel-specific features (e.g., caching, multi-connection).Guzzle, or other libraries).composer.json:
"require": {
"graham-campbell/github": "^13.1",
"knplabs/github-api": "^3.16"
}
composer require graham-campbell/github.php artisan vendor:publish --provider="GrahamCampbell\GitHub\GitHubServiceProvider".config/github.php with your auth method (e.g., token):
'connections' => [
'main' => [
'auth' => 'token',
'token' => env('GITHUB_TOKEN'),
],
],
Guzzle.// Old: Guzzle
$client = new \GuzzleHttp\Client();
$response = $client->get('https://api.github.com/user/orgs', [
'auth' => [env('GITHUB_TOKEN'), 'x-oauth-basic']
]);
// New: Facade
$orgs = GitHub::me()->organizations();
$client = GitHub::connection()->getClient();
$issues = $client->api('issue')->all('GrahamCampbell', 'Laravel-GitHub');
401 Unauthorized, 404 Not Found).lcobucci/jwt v4+).php-github-api v3.x, which supports GitHub REST API v3. For GraphQL, use the underlying client directly.graham-campbell/bounded-cache. For custom caching, extend the CacheFactory or disable caching in config..env for credentials (e.g., GITHUB_TOKEN).How can I help you explore Laravel packages today?