Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GitLab API v4 client for PHP

License

NotificationsYou must be signed in to change notification settings

GitLabPHP/Client

Repository files navigation

We present a modernGitLab API v4 client for PHP.

Banner

Build StatusStyleCI StatusSoftware LicensePackagist DownloadsLatest Version

This is strongly based onphp-github-api byKnpLabs. With this in mind, we now havevery similar clients for:

Check out thechange log,releases,security policy,license,code of conduct, andcontribution guidelines.

Installation

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.

Standard Installation

$ composer require"m4tthumphrey/php-gitlab-api:^12.0""guzzlehttp/guzzle:^7.9.2"

Framework Integration

Laravel:

$ composer require"graham-campbell/gitlab:^8.0"

Symfony:

$ 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.

General API Usage

// 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,]);

Self-Hosted GitLab

$client =newGitlab\Client();$client->setUrl('https://git.yourdomain.com');$client->authenticate('your_http_token',Gitlab\Client::AUTH_HTTP_TOKEN);

Example with Pager

$pager =newGitlab\ResultPager($client);$issues =$pager->fetchAll($client->issues(),'all', [null, ['state' =>'closed']]);

HTTP Client Builder

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.

Contributing

We will gladly receive issue reports and review and accept pull requests, in accordance with ourcode of conduct andcontribution guidelines!

$ make install$ make test

Security

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.

License

GitLab PHP API Client is licensed underThe MIT License (MIT).


[8]ページ先頭

©2009-2025 Movatter.jp