Symfony2 Bundle to include the gitlab api.

v3.1.1 2018-05-24 20:42 UTC


Build Status

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

Step 1: Install Zeichen32GitLabApiBundle

The preferred way to install this bundle is to rely on Composer.

    "require": {
        // ...
        "zeichen32/gitlabapibundle": "~3.0"

Step 2: Enable the bundle

Finally, enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Zeichen32\GitLabApiBundle\Zeichen32GitLabApiBundle(),

Step 3: Configure Zeichen32GitLabApiBundle

Add Zeichen32GitLabApiBundle settings in app/config/config.yml:

            token: your-api-token
            url: http://example.org/api/v3/
            auth_method: url_token
            token: your-api-token
            url: http://example.org/api/v3/
            auth_method: http_token
            sudo: 1
            token: your-api-token
            url: http://example.org/api/v3/
            alias: custom_alias

The first client is defined automatically as your default client.

Step 4: Use the gitlab api

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.

Step 5: Configuration Reference

All available configuration options are listed below with their default values.

    clients:              # Required
        token:                ~ # Required
        url:                  ~ # Required
        auth_method:          ~ http_token|url_token|oauth_token
        sudo:                 ~
        alias:                ~
        http_client:          ~ # http plug client service id


This bundle is under the MIT license. See the complete license in the bundle: