Gitlab CI SDK
, (*1)
NOTE : If you want to contribute don't hesitate, I'll review any PR., (*2)
Introduction
Gitlab CI SDK is a PHP Wrapper for use with the Gitlab CI API., (*3)
Based on php-gitlab-api., (*4)
Requirements
Installation
Main Setup
By cloning project
- Install the Buzz (>=0.7) by cloning them into
./vendor/.
- Clone this project into your
./vendor/ directory.
With composer
-
Add this project in your composer.json:, (*5)
"require": {
"neilime/php-gitlab-ci-sdk": "1.0.0"
}
-
Now tell composer to download AssetsBundle by running the command:, (*6)
$ php composer.phar update
General API Usage
$oClient = new \GitlabCI\Client('http://ci.example.com/api/v1/'); // change here
$oClient->authenticate('your_gitlab_ci_token_here','http://demo.gitlab.com', \GitlabCI\Client::AUTH_URL_TOKEN); // change here
$oProject = $oClient->api('projects')->create('My Project', array(
'gitlab_id' => 2,
));
Model Usage
You can also use the library in an object oriented manner., (*7)
$oClient = new \GitlabCI\Client('http://ci.example.com/api/v1/'); // change here
$oClient->authenticate('your_gitlab_ci_token_here','http://demo.gitlab.com', \GitlabCI\Client::AUTH_URL_TOKEN); // change here
Creating a new project, (*8)
```php
$oProject = \GitlabCI\Model\Project::create($oClient, 'My Project', array(
'gitlab_id' => 2,
));, (*9)