juniyadi/laravel-github-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

juniyadi/laravel-github-api

Composer 安装命令:

composer require juniyadi/laravel-github-api

包简介

README 文档

README

A modular, testable, and Laravel-friendly package for interacting with the GitHub API. Provides clean separation of concerns and easy integration via Laravel facades and service providers.

Features

  • Modular API classes: User, Repo, Org, Issues, Pull Requests, Releases, Search, Webhooks, Actions, Projects, Teams, Gists, Check Runs
  • Laravel Facade for static access
  • Service provider for easy configuration
  • PSR-4 autoloading and contracts for testability

Available Methods

User API

Method Description
me Get authenticated user information
show Get information about a specific user

Repository API

Method Description
getRepositories List repositories for a user
getBranches List branches for a repository
show Show repository or file details
upload Upload a file to a repository
uploadBulk Upload multiple files to a repository
uploadBulkBlob Bulk upload with single commit using Git Data API
delete Delete a file from a repository
deleteBulk Delete multiple files from a repository
deleteBulkBlob Delete multiple files with single commit

Organization API

Method Description
getOrganizationRepositories List repositories for an organization
show Get information about an organization

Issues API

Method Description
getIssues List issues in a repository
createIssue Create a new issue
updateIssue Update an existing issue
getIssueComments Get comments on an issue
createIssueComment Comment on an issue

Pull Requests API

Method Description
getPullRequests List PRs in a repository
createPullRequest Create a new PR
updatePullRequest Update a PR
mergePullRequest Merge a PR
getPullRequestFiles List files in a PR

Releases API

Method Description
getReleases List releases for a repository
getRelease Get a single release
createRelease Create a release
updateRelease Update a release
deleteRelease Delete a release

Search API

Method Description
searchRepositories Search repositories
searchCode Search code
searchUsers Search users
searchIssues Search issues and pull requests

Webhooks API

Method Description
getWebhooks List webhooks for a repository
createWebhook Create a webhook
updateWebhook Update a webhook
deleteWebhook Delete a webhook

Actions API

Method Description
getWorkflows List workflows in a repository
getWorkflowRuns List workflow runs
rerunWorkflow Re-run a workflow
getWorkflowRunLogs Download workflow logs

Projects API

Method Description
getProjects List projects for a repo/org/user
createProject Create a project
updateProject Update a project
deleteProject Delete a project

Teams API

Method Description
getTeams List teams in an organization
createTeam Create a team
updateTeam Update a team
deleteTeam Delete a team
getTeamMembers List team members
addTeamMember Add a team member

Gists API

Method Description
getGists List gists for authenticated user
createGist Create a gist
updateGist Update a gist
deleteGist Delete a gist

Check Runs API

Method Description
getCheckRuns Get check runs for a reference
createCheckRun Create a check run
updateCheckRun Update a check run

Installation

composer require juniyadi/laravel-github-api

Publish the config file:

php artisan vendor:publish --provider="JuniYadi\GitHub\Providers\LaravelGithubServiceProvider" --tag=config

Set your GitHub token in config/github.php or your .env:

GITHUB_TOKEN=your_github_token

Usage

Facade Example

use JuniYadi\GitHub\Facades\Github;

// User operations
$user = Github::user()->me();
$repos = Github::repo()->getRepositories('octocat');
$orgRepos = Github::org()->getOrganizationRepositories('laravel');

// Repository content
$file = Github::repo()->show('octocat', 'Hello-World');
// Read Readme file
$file = Github::repo()->show('octocat', 'Hello-World', 'README.md');

// Issues and PRs
$issues = Github::issues()->getIssues('owner/repo');
$pr = Github::pullRequest()->createPullRequest('owner/repo', 'title', 'head', 'base', 'body');

// Other operations
$releases = Github::release()->getReleases('owner/repo');
$searchResults = Github::search()->searchRepositories('language:php stars:>1000');
$workflows = Github::actions()->getWorkflows('owner/repo');

Dependency Injection Example

use JuniYadi\GitHub\Github;

public function __construct(Github $github) {
    $this->github = $github;
}

public function show() {
    return $this->github->user()->me();
}

Documentation

Bulk File Operations

use JuniYadi\GitHub\Facades\Github;

// Upload multiple files in a single commit
$files = [
    [
        'file' => 'path/to/file1.txt',
        'content' => 'File 1 content'
    ],
    [
        'file' => 'path/to/file2.txt',
        'content' => 'File 2 content'
    ]
];

// Upload files with a single commit
$result = Github::repo()->uploadBulkBlob('owner/repo', 'main', $files, 'Bulk upload commit message');

// Delete multiple files or directories in a single commit
$filesToDelete = [
    'path/to/file1.txt',
    'path/to/directory',  // Will delete directory and all contents
    'path/to/file2.txt'
];

$result = Github::repo()->deleteBulkBlob('owner/repo', 'main', $filesToDelete, 'Bulk delete commit message');

See the docs/ directory for detailed usage of each API class.

juniyadi/laravel-github-api 适用场景与选型建议

juniyadi/laravel-github-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 325 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 05 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 juniyadi/laravel-github-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 juniyadi/laravel-github-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 juniyadi/laravel-github-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 325
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-10