2017 © Pedro Peláez
 

library php-gitlab-api

GitLab API client

image

benmag/php-gitlab-api

GitLab API client

  • Tuesday, July 26, 2016
  • by benmag
  • Repository
  • 1 Watchers
  • 0 Stars
  • 21 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 231 Forks
  • 0 Open issues
  • 20 Versions
  • 0 % Grown

The README.md

A PHP wrapper to be used with Gitlab's API.

Build Status StyleCI Total Downloads Latest Stable Version Latest Unstable Version, (*1)

Based on php-github-api and code from KnpLabs., (*2)

Installation

Via composer, (*3)

composer require m4tthumphrey/php-gitlab-api php-http/guzzle6-adapter:^1.0

Why php-http/guzzle6-adapter? We are decoupled from any HTTP messaging client with help by HTTPlug., (*4)

You can visit HTTPlug for library users to get more information about installing HTTPlug related packages., (*5)

Versioning

Depending on your Gitlab server version, you must choose the right version of this library. Please refer to the following table to pick the right one., (*6)

Version Gitlab API Version Gitlab Version
9.x V4 >= 9.0
8.x V3 < 9.5

General API Usage

$client = \Gitlab\Client::create('http://git.yourdomain.com')
    ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN)
;

// or for OAuth2 (see https://github.com/m4tthumphrey/php-gitlab-api/blob/master/lib/Gitlab/HttpClient/Plugin/Authentication.php#L47)
$client = \Gitlab\Client::create('http://gitlab.yourdomain.com')
    ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_OAUTH_TOKEN)
;

$project = $client->api('projects')->create('My Project', array(
  'description' => 'This is a project',
  'issues_enabled' => false
));

Example with Pager

to fetch all your closed issue with pagination ( on the gitlab api ), (*7)

$client = \Gitlab\Client::create('http://git.yourdomain.com')
    ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN)
;
$pager = new \Gitlab\ResultPager($client);
$issues = $pager->fetchAll($client->api('issues'),'all',[null, ['state' => 'closed']]);

Model Usage

You can also use the library in an object oriented manner:, (*8)

$client = \Gitlab\Client::create('http://git.yourdomain.com')
    ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN)
;

# Creating a new project
$project = \Gitlab\Model\Project::create($client, 'My Project', array(
  'description' => 'This is my project',
  'issues_enabled' => false
));

$project->addHook('http://mydomain.com/hook/push/1');

# Creating a new issue
$project = new \Gitlab\Model\Project(1, $client);
$issue = $project->createIssue('This does not work.', array(
  'description' => 'This doesn\'t work properly. Please fix.',
  'assignee_id' => 2
));

# Closing that issue
$issue->close();

You get the idea! Take a look around (API methods, models) and please feel free to report any bugs., (*9)

Framework Integrations

  • Symfony - https://github.com/Zeichen32/GitLabApiBundle
  • Laravel - https://github.com/GrahamCampbell/Laravel-GitLab

If you have integrated GitLab into a popular PHP framework, let us know!, (*10)

Contributing

There are many parts of Gitlab that I have not added to this as it was originally created for personal use, hence the lack of tests. Feel free to fork and add new functionality and tests, I'll gladly accept decent pull requests., (*11)

The Versions

26/07 2016

dev-master

9999999-dev https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

26/07 2016

7.13.2

7.13.2.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

20/06 2016

7.13.1

7.13.1.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

28/07 2015

7.13.0

7.13.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

29/05 2015

7.11.0

7.11.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

06/05 2015

7.10.0

7.10.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

23/03 2015

7.9.0

7.9.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

23/02 2015

7.8.0

7.8.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

The Development Requires

api gitlab

22/07 2014

6.9.1

6.9.1.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

19/06 2014

6.9.0

6.9.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

10/01 2014

6.4.3

6.4.3.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

18/11 2013

6.2.2

6.2.2.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

28/10 2013

6.2.1

6.2.1.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

28/10 2013

6.2.0

6.2.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

24/09 2013

6.1.0

6.1.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

28/08 2013

6.0.0

6.0.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

14/08 2013

0.7.1

0.7.1.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

27/06 2013

0.7.0

0.7.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

26/06 2013

0.6.1

0.6.1.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab

18/06 2013

0.6.0

0.6.0.0 https://github.com/m4tthumphrey/php-gitlab-api

GitLab API client

  Sources   Download

MIT

The Requires

 

api gitlab