Giter VIP home page Giter VIP logo

gitlabapibundle's Introduction

Getting Started With Zeichen32GitLabApiBundle

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": "~2.0"
    }
}

Step 2: Enable the bundle

Finally, enable the bundle in the kernel:

<?php
// app/AppKernel.php

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

Step 3: Configure 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.

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.

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:         ~

License

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

Resources/meta/LICENSE

gitlabapibundle's People

Contributors

violuke avatar zeichen32 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.