m4tthumphrey/php-gitlab-api
Composer 安装命令:
composer require m4tthumphrey/php-gitlab-api
包简介
GitLab API v4 client for PHP
README 文档
README
We present a modern GitLab API v4 client for PHP.
This is strongly based on php-github-api by KnpLabs. With this in mind, we now have very similar clients for:
- Bitbucket - bitbucket/client by Graham Campbell.
- GitHub - knplabs/github-api by KnpLabs.
- GitLab - m4tthumphrey/php-gitlab-api which is this package!
Check out the change log, releases, security policy, license, code of conduct, and contribution guidelines.
Installation
This version supports PHP 8.1-8.5. To get started, simply require the project using Composer. You will also need to install packages that "provide" psr/http-client-implementation and psr/http-factory-implementation.
Standard Installation
$ composer require "m4tthumphrey/php-gitlab-api:^12.1" "guzzlehttp/guzzle:^7.9.2"
Framework Integration
Laravel:
$ composer require "graham-campbell/gitlab:^8.1"
Symfony:
$ composer require "zeichen32/gitlabapibundle:^7.0"
We are decoupled from any HTTP messaging client by using PSR-7, PSR-17, PSR-18, and HTTPlug. You can visit HTTPlug for library users to get more information about installing HTTPlug related packages. The framework integration graham-campbell/gitlab is by Graham Campbell and zeichen32/gitlabapibundle is by Jens Averkamp.
General API Usage
$client = new Gitlab\Client(); // Choose one authentication method. // Personal access token authentication $client->authenticate('your_access_token', Gitlab\Client::AUTH_HTTP_TOKEN); // OAuth2 authentication // $client->authenticate('your_oauth_token', Gitlab\Client::AUTH_OAUTH_TOKEN); // An example API call $project = $client->projects()->create('My Project', [ 'description' => 'This is a project', 'issues_access_level' => 'disabled', ]);
Self-Hosted GitLab
$client = new Gitlab\Client(); $client->setUrl('https://git.yourdomain.com'); $client->authenticate('your_access_token', Gitlab\Client::AUTH_HTTP_TOKEN);
Example with Pager
$pager = new Gitlab\ResultPager($client); $issues = $pager->fetchAll($client->issues(), 'all', [null, ['state' => 'closed']]);
HTTP Client Builder
By providing a Gitlab\HttpClient\Builder to the Gitlab\Client constructor, you can customize the HTTP client. For example, to customize the user agent:
$plugin = new Http\Client\Common\Plugin\HeaderSetPlugin([ 'User-Agent' => 'Foobar', ]); $builder = new Gitlab\HttpClient\Builder(); $builder->addPlugin($plugin); $client = new Gitlab\Client($builder);
One can read more about HTTPlug plugins here. Take a look around the API methods, and please feel free to report any bugs, noting our code of conduct.
Contributing
We will gladly receive issue reports and review and accept pull requests, in accordance with our code of conduct and contribution guidelines!
$ make install
$ make test
Security
If you discover a security vulnerability within this package, please send an email to Graham Campbell at hello@gjcampbell.co.uk. All security vulnerabilities will be promptly addressed. You may view our full security policy here.
License
GitLab PHP API Client is licensed under The MIT License (MIT).
m4tthumphrey/php-gitlab-api 适用场景与选型建议
m4tthumphrey/php-gitlab-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.79M 次下载、GitHub Stars 达 951, 最近一次更新时间为 2012 年 11 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「gitlab」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 m4tthumphrey/php-gitlab-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 m4tthumphrey/php-gitlab-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 m4tthumphrey/php-gitlab-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP GitLab generic API client (not stick to any version)
A collection of monolog handlers using PSR-18 http client
A PSR-7 compatible library for making CRUD API endpoints
Creates & updates issues on a GitLab repository from Symfony2 exceptions
Library to handle Webhooks from various services.
A PSR-15 middleware to manage Gitlab hooks.
统计信息
- 总下载量: 5.79M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 956
- 点击次数: 22
- 依赖项目数: 71
- 推荐数: 4
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-23
