jeroeny / gitlab-api
This package is abandoned and no longer maintained.
The author suggests using the m4tthumphrey/php-gitlab-api package instead.
GitLab API client
v10.0.3
2020-01-09 12:08 UTC
Requires
- php: ^7.2
- ext-json: *
- ext-xml: *
- php-http/client-common: ^2.0
- php-http/discovery: ^1.7
- php-http/httplug: ^2.0
- php-http/message: ^1.8
- php-http/multipart-stream-builder: ^1.1
- symfony/options-resolver: ^4.4 || ^5.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.5
- doctrine/coding-standard: ^6.0 || ^7.0
- ergebnis/composer-normalize: ^2.2
- guzzlehttp/psr7: ^1.6
- laminas/laminas-diactoros: 2.2
- moxio/php-codesniffer-sniffs: ^2.3
- php-http/guzzle6-adapter: ^2.0
- php-http/mock-client: ^1.3
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^8.4
- slevomat/coding-standard: ^5.0 || ^6.0
- squizlabs/php_codesniffer: ^3.5
- dev-master
- v10.0.3
- v10.0.2
- v10.0.1
- v10.0.0
- 9.13.0
- 9.12.0
- 9.11.0
- 9.10.0
- 9.9.0
- 9.8.0
- 9.7.0
- 9.6.1
- 9.6.0
- 9.5.0
- 9.4.0
- 9.3.0
- 9.2.0
- 9.1.0
- 9.0.0
- 9.0.0-rc1
- 9.0.0-beta2
- 9.0.0-beta1
- 8.0.0
- 7.15.0
- 7.14.0
- 7.13.1
- 7.13.0
- 7.11.0
- 7.10.0
- 7.9.0
- 7.8.0
- 6.9.1
- 6.9.0
- 6.4.3
- 6.2.2
- 6.2.1
- 6.2.0
- 6.1.0
- 6.0.0
- 0.7.1
- 0.7.0
- 0.6.1
- 0.6.0
- dev-dependabot/composer/laminas/laminas-diactoros-2.3.0
- dev-update
- dev-symfony-5
This package is auto-updated.
Last update: 2022-09-21 17:47:25 UTC
README
Forked from php-gitlab-api and based on php-github-api and code from KnpLabs.
Installation
Using composer:
composer require jeroeny/gitlab-api
You can visit HTTPlug for library users to get more information about installing HTTPlug related packages.
General API Usage
$client = \Gitlab\Client::create('http://git.yourdomain.com') ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN) ; // or for OAuth2 (see https://github.com/m4tthumphrey/php-gitlab-api/blob/master/lib/Gitlab/HttpClient/Plugin/Authentication.php#L47) $client = \Gitlab\Client::create('http://gitlab.yourdomain.com') ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_OAUTH_TOKEN) ; $project = $client->api('projects')->create('My Project', array( 'description' => 'This is a project', 'issues_enabled' => false ));
Example with Pager
to fetch all your closed issue with pagination ( on the gitlab api )
$client = \Gitlab\Client::create('http://git.yourdomain.com') ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN) ; $pager = new \Gitlab\ResultPager($client); $issues = $pager->fetchAll($client->api('issues'),'all',[null, ['state' => 'closed']]);
Model Usage
You can also use the library in an object oriented manner:
$client = \Gitlab\Client::create('http://git.yourdomain.com') ->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN) ; # Creating a new project $project = \Gitlab\Model\Project::create($client, 'My Project', array( 'description' => 'This is my project', 'issues_enabled' => false )); $project->addHook('http://mydomain.com/hook/push/1'); # Creating a new issue $project = new \Gitlab\Model\Project(1, $client); $issue = $project->createIssue('This does not work.', array( 'description' => 'This doesn\'t work properly. Please fix.', 'assignee_id' => 2 )); # Closing that issue $issue->close();
You get the idea! Take a look around (API methods, models) and please feel free to report any bugs.
Framework Integrations
- Symfony - https://github.com/Zeichen32/GitLabApiBundle
- Laravel - https://github.com/GrahamCampbell/Laravel-GitLab
If you have integrated GitLab into a popular PHP framework, let us know!
Contributing
Feel free to fork and add new functionality and/or tests, I'll gladly accept decent pull requests.