fgrosse/gitlab-api

This package is abandoned and no longer maintained. No replacement package was suggested.

A guzzle 5 client for the gitlab API using service descriptions

0.9.0 2015-09-28 17:47 UTC

This package is not auto-updated.

Last update: 2020-10-02 20:44:38 UTC


README

PHP Gitlab API

Build Status HHVM Status PHP 7 ready Coverage Status Scrutinizer Code Quality

Latest Stable Version Latest Unstable Version License

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.

Implemented APIs (Gitlab ~7.7)

Dependencies

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.

Installation

The preferred way to install this library is to rely on Composer:

$ composer require fgrosse/gitlab-api

Usage

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.

Not implemented APIs (yet)

  • 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

License

This library is distributed under the MIT License.