This Bundle integrate the Gitlab API Wrapper into your Symfony2 Project.
Attention: I have refactor the whole bundle and have remove the issue tracker to decouple the issue tracker from the bundle. The old version with the issue tracker is still available in the 1.0.x Branche
The preferred way to install this bundle is to rely on Composer.
{
"require": {
// ...
"zeichen32/gitlabapibundle": "~2.0"
}
}
Finally, enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Zeichen32\GitLabApiBundle\Zeichen32GitLabApiBundle(),
);
}
Add Zeichen32GitLabApiBundle settings in app/config/config.yml:
zeichen32_git_lab_api:
clients:
firstclient:
token: your-api-token
url: http://example.org/api/v3/
auth_method: url_token
secondclient:
token: your-api-token
url: http://example.org/api/v3/
auth_method: http_token
sudo: 1
options:
timeout: 60
user_agent: MyApp (http://example.org)
thirdclient:
token: your-api-token
url: http://example.org/api/v3/
alias: custom_alias
The first client is defined automatically as your default client.
If you want to use the default client, you can easy getting the client by the "gitlab_api" service-id.
$api = $this->get('gitlab_api');
$issues = $api->api('issues')->all($project_id);
If you want to get one of the other clients, you can getting the specific client by the "zeichen32_gitlabapi.client.CLIENT_NAME" service id.
$api = $this->get('zeichen32_gitlabapi.client.secondclient');
$issues = $api->api('issues')->all($project_id);
Or if you set alias option:
$api = $this->get('custom_alias');
$issues = $api->api('issues')->all($project_id);
For more information about using the api, take a look at the Gitlab Client Documentation.
All available configuration options are listed below with their default values.
zeichen32_git_lab_api:
clients: # Required
token: ~ # Required
url: ~ # Required
auth_method: ~ http_token|url_token|oauth_token
sudo: ~
alias: ~
http_client: ~ # Buzz client service id
options:
timeout: ~
user_agent: ~
This bundle is under the MIT license. See the complete license in the bundle:
Resources/meta/LICENSE