Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork455
GitLab API v4 client for PHP
License
GitLabPHP/Client
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
We present a modernGitLab API v4 client for PHP.
This is strongly based onphp-github-api byKnpLabs. With this in mind, we now havevery similar clients for:
- Bitbucket -bitbucket/client byGraham Campbell.
- GitHub -knplabs/github-api byKnpLabs.
- GitLab -m4tthumphrey/php-gitlab-api which is this package!
Check out thechange log,releases,security policy,license,code of conduct, andcontribution guidelines.
This version supportsPHP 8.1-8.4. To get started, simply require the project usingComposer. You will also need to install packages that "provide"psr/http-client-implementation
andpsr/http-factory-implementation
.
$ composer require"m4tthumphrey/php-gitlab-api:^12.0""guzzlehttp/guzzle:^7.9.2"
$ composer require"graham-campbell/gitlab:^8.0"
$ composer require"zeichen32/gitlabapibundle:^7.0"
We are decoupled from any HTTP messaging client by usingPSR-7,PSR-17,PSR-18, andHTTPlug. You can visitHTTPlug for library users to get more information about installing HTTPlug related packages. The framework integrationgraham-campbell/gitlab is byGraham Campbell andzeichen32/gitlabapibundle is byJens Averkamp.
// Token authentication$client =newGitlab\Client();$client->authenticate('your_http_token',Gitlab\Client::AUTH_HTTP_TOKEN);// OAuth2 authentication$client =newGitlab\Client();$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_enabled' =>false,]);
$client =newGitlab\Client();$client->setUrl('https://git.yourdomain.com');$client->authenticate('your_http_token',Gitlab\Client::AUTH_HTTP_TOKEN);
$pager =newGitlab\ResultPager($client);$issues =$pager->fetchAll($client->issues(),'all', [null, ['state' =>'closed']]);
By providing aGitlab\HttpClient\Builder
to theGitlab\Client
constructor, you can customize the HTTP client. For example, to customize the user agent:
$plugin =newHttp\Client\Common\Plugin\HeaderSetPlugin(['User-Agent' =>'Foobar',]);$builder =newGitlab\HttpClient\Builder();$builder->addPlugin($plugin);$client =newGitlab\Client($builder);
One can read more about HTTPlug pluginshere. Take a look around theAPI methods, and please feel free to report any bugs, noting ourcode of conduct.
We will gladly receive issue reports and review and accept pull requests, in accordance with ourcode of conduct andcontribution guidelines!
$ make install$ make test
If you discover a security vulnerability within this package, please send an email to Graham Campbell athello@gjcampbell.co.uk. All security vulnerabilities will be promptly addressed. You may view our full security policyhere.
GitLab PHP API Client is licensed underThe MIT License (MIT).
About
GitLab API v4 client for PHP
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.