GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - GitLabPHP/Client: GitLab API v4 client for PHP

BranchesTags
Open more actions menu

Latest commit

 

History

1,702 Commits
1,702 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
src
src
 
 
tests
tests
 
 
vendor-bin
vendor-bin
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.styleci.yml
.styleci.yml
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
phpstan-baseline.neon
phpstan-baseline.neon
 
 
phpstan.neon.dist
phpstan.neon.dist
 
 
phpunit.xml.dist
phpunit.xml.dist
 
 
psalm-baseline.xml
psalm-baseline.xml
 
 
psalm.xml
psalm.xml
 
 

Repository files navigation

GitLab PHP API Client

We present a modern GitLab API v4 client for PHP.

Banner

Build Status StyleCI Status Software License Packagist Downloads Latest Version

This is strongly based on php-github-api by KnpLabs. With this in mind, we now have very similar clients for:

  • Bitbucket - bitbucket/client by Graham Campbell.
  • GitHub - knplabs/github-api by KnpLabs.
  • GitLab - m4tthumphrey/php-gitlab-api which is this package!

Check out the change log, releases, security policy, license, code of conduct, and contribution guidelines.

Installation

This version supports PHP 8.1-8.5. To get started, simply require the project using Composer. You will also need to install packages that "provide" psr/http-client-implementation and psr/http-factory-implementation.

Standard Installation

$ composer require "m4tthumphrey/php-gitlab-api:^12.1" "guzzlehttp/guzzle:^7.9.2"

Framework Integration

Laravel:

$ composer require "graham-campbell/gitlab:^8.1"

Symfony:

$ composer require "zeichen32/gitlabapibundle:^7.0"

We are decoupled from any HTTP messaging client by using PSR-7, PSR-17, PSR-18, and HTTPlug. You can visit HTTPlug for library users to get more information about installing HTTPlug related packages. The framework integration graham-campbell/gitlab is by Graham Campbell and zeichen32/gitlabapibundle is by Jens Averkamp.

General API Usage

$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',
]);

Self-Hosted GitLab

$client = new Gitlab\Client();
$client->setUrl('https://git.yourdomain.com');
$client->authenticate('your_access_token', Gitlab\Client::AUTH_HTTP_TOKEN);

Example with Pager

$pager = new Gitlab\ResultPager($client);
$issues = $pager->fetchAll($client->issues(), 'all', [null, ['state' => 'closed']]);

HTTP Client Builder

By providing a Gitlab\HttpClient\Builder to the Gitlab\Client constructor, you can customize the HTTP client. For example, to customize the user agent:

$plugin = new Http\Client\Common\Plugin\HeaderSetPlugin([
    'User-Agent' => 'Foobar',
]);

$builder = new Gitlab\HttpClient\Builder();
$builder->addPlugin($plugin);

$client = new Gitlab\Client($builder);

One can read more about HTTPlug plugins here. Take a look around the API methods, and please feel free to report any bugs, noting our code of conduct.

Contributing

We will gladly receive issue reports and review and accept pull requests, in accordance with our code of conduct and contribution guidelines!

$ make install
$ make test

Security

If you discover a security vulnerability within this package, please send an email to Graham Campbell at [email protected]. All security vulnerabilities will be promptly addressed. You may view our full security policy here.

License

GitLab PHP API Client is licensed under The MIT License (MIT).

About

GitLab API v4 client for PHP

Topics

apiapi-clientgitlabgitlab-apihttplugphp

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

952 stars

Watchers

30 watching

Forks

449 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.