akira/laravel-github
Composer 安装命令:
composer require akira/laravel-github
包简介
Advanced GitHub API integration for Laravel 12 with typed DTOs and Collections.
README 文档
README
A Laravel 12+ package to interact with the GitHub REST and GraphQL APIs using a strongly-typed, collection-friendly interface.
This package provides:
- Fully typed DTOs for common GitHub resources (users, repos, issues, PRs, actions, packages, dependabot, etc.).
- High-level service
GitHubManagerwith caching and rate limiting. - Artisan commands to quickly query GitHub resources.
- 100% test coverage with Pest and static analysis with Larastan.
Installation
composer require akira/laravel-github
php artisan vendor:publish --tag=config --provider="Akira\\GitHub\\GitHubServiceProvider"
Configuration
return [ 'token' => env('GITHUB_TOKEN', null), 'cache' => [ 'ttl' => 300, 'prefix' => 'github:', 'ttls' => [ 'issues' => 60, 'pulls' => 60, 'releases' => 300, ], ], 'pagination' => ['per_page' => 30], 'rate_limiter' => ['max' => 60, 'decay_seconds' => 60], 'events' => true, ];
Usage Examples
Users
$user = GitHub::user('octocat'); $repos = GitHub::userRepos('octocat');
Repositories
$repo = GitHub::repo('akira', 'hunter');
Issues
$issues = GitHub::issues('akira', 'hunter'); $new = GitHub::createIssue('akira', 'hunter', 'Bug', 'Description'); GitHub::commentOnIssue('akira', 'hunter', $new->number, 'Working on it!');
Pull Requests
$prs = GitHub::pulls('akira', 'hunter');
Releases
$releases = GitHub::releases('akira', 'hunter');
Organizations and Teams
$org = GitHub::organization('akira-io'); $repos = GitHub::orgRepos('akira-io'); $teams = GitHub::teams('akira-io');
Gists
$gists = GitHub::gists('octocat'); $gist = GitHub::gist('123');
GitHub Actions
$runs = GitHub::actionsWorkflowRuns('akira', 'hunter'); GitHub::actionsRerun('akira', 'hunter', $runs[0]->id); GitHub::actionsCancel('akira', 'hunter', $runs[0]->id); GitHub::actionsDownloadArtifact('akira', 'hunter', $runs[0]->id, storage_path('artifact.zip'));
Checks
$checks = GitHub::checksForRef('akira', 'hunter', 'main');
Packages
$packages = GitHub::orgPackages('akira-io', 'container');
Dependabot Alerts
$alerts = GitHub::dependabotAlerts('akira', 'hunter');
Projects V2 (GraphQL)
$projects = GitHub::projectsV2('akira');
Webhook Verification
$isValid = GitHub::verifyWebhookSignature($secret, $payload, $signature);
Artisan Commands
php artisan github:user octocat php artisan github:repo akira hunter php artisan github:issue:list akira hunter php artisan github:pr:list akira hunter php artisan github:actions:runs akira hunter --per_page=5
📚 Documentation
This package also includes a dedicated docs/ folder with extended details:
- Installation — docs/installation.md
- Configuration — docs/configuration.md
- Usage — docs/usage.md
- Commands — docs/commands.md
- Advanced Topics — docs/advanced.md
- Contributing — docs/contributing.md
- Roadmap — docs/roadmap.md
Project Structure
laravel-github/
├── src/ # Package source code
├── tests/ # Pest test suite
├── docs/ # Extended documentation
├── README.md # Quick start & inline docs
├── composer.json
└── pest.php / phpunit.xml
Contributing
- Fork the repo
- Create your feature branch (
git checkout -b feature/my-feature) - Run tests (
composer test) - Ensure code style and static analysis pass (
composer analyse) - Submit a PR
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-25