This is a php client for the gitlab API. This client bases on Guzzle 5 with service descriptions. You can have a quick overview of the implemented gitlab APIs in the yml files in lib/Client/ServiceDescription.
Gitlab-api requires at least PHP 5.5
and also been successfully tested using PHP 7
and HHVM
.
Furthermore the whole client is build upon the awesome Guzzle Services by Michael Dowling.
The preferred way to install this library is to rely on Composer:
$ composer require fgrosse/gitlab-api
The API is still work in progress and the actual usage might change in the future.
The stable part of this API is available through the GitlabClient interface:
$guzzleClient = GitlabGuzzleClient::factory([
'base_url' => $baseUrl,
'api_token' => $token,
]);
$client = new HttpGitlabClient($guzzleClient);
$mergeRequests = $client->listMergeRequests($project,
$state='closed',
$order='updated_at',
$sort='asc',
$page=1, $perPage=5
);
If you want to access more functionality consider using the GitlabClient
directly:
$client = GitlabClient::factory([
'base_url' => $baseUrl,
'api_token' => $token,
]);
$mergeRequests = $client->listMergeRequests([
'project_id' => $project,
'state' => 'closed',
'order_by' => 'updated_at',
'sort' => 'asc',
'page' => 0,
'per_page' => 5,
]);
Checkout the lib/Client/ServiceDescription to see the available parameters for each API call. An executable example can be found in examples/merge_requests/api.php.
- deploy_key_multiple_projects API
- deploy_keys API
- groups API
- milestones API
- notes API
- oauth2 API
- project_snippets API
- projects API
- repositories API
- repository_files API
- services API
- session API
- system_hooks API
- users API
This library is distributed under the MIT License.