1. Go to this page and download the library: Download m4tthumphrey/php-gitlab-api 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/ */
m4tthumphrey / php-gitlab-api example snippets
$client = new Gitlab\Client();
// Choose one authentication method.
// Personal access token authentication
$client->authenticate('your_access_token', Gitlab\Client::AUTH_HTTP_TOKEN);
// OAuth2 authentication
// $client->authenticate('your_oauth_token', Gitlab\Client::AUTH_OAUTH_TOKEN);
// An example API call
$project = $client->projects()->create('My Project', [
'description' => 'This is a project',
'issues_access_level' => 'disabled',
]);
$client = new Gitlab\Client();
$client->setUrl('https://git.yourdomain.com');
$client->authenticate('your_access_token', Gitlab\Client::AUTH_HTTP_TOKEN);