PHP code example of benmag / gitlab

1. Go to this page and download the library: Download benmag/gitlab library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

benmag / gitlab example snippets


// Fetch projects.
$gitlab->api('projects')->all();

// Create Issues.
$gitlab->api('issues')->create($id, $params);

// Want to use the facade?
GitLab::api('users')->show($id);

Vinkla\GitLab\GitLabServiceProvider::class

'GitLab' => Vinkla\GitLab\Facades\GitLab::class

// You can alias this in config/app.php.
use Vinkla\GitLab\Facades\GitLab;

GitLab::api('projects')->all();
// We're done here - how easy was that, it just works!

GitLab::api('users')->all(true);
// This example is simple and there are far more methods available.

use Vinkla\GitLab\Facades\GitLab;

// Writing this…
GitLab::connection('main')->api('projects')->all();

// …is identical to writing this
GitLab::api('projects')->all();

// and is also identical to writing this.
GitLab::connection()->api('projects')->all();

// This is because the main connection is configured to be the default.
GitLab::getDefaultConnection(); // This will return main.

// We can change the default connection.
GitLab::setDefaultConnection('alternative'); // The default is now alternative.

use Vinkla\GitLab\GitLabManager;

class Foo
{
	protected $gitlab;

	public function __construct(GitLabManager $gitlab)
	{
		$this->gitlab = $gitlab;
	}

	public function bar()
	{
		$this->gitlab->api('users')->all(true);
	}
}

App::make('Foo')->bar();
bash
php artisan vendor:publish