Skip to content

Merging from upstream #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 132 commits into from
Sep 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
e26dcb2
Added method to retrieve issues closed by a merge request
cdaguerre Jan 6, 2017
83cf330
Added issue boards api
cdaguerre Jan 6, 2017
93bc1c3
Adding of path to list of properties in Node Model, also fixed Projec…
donkidd Apr 25, 2017
df94484
Add Projects to Group Model and added to API so projects can be obtai…
donkidd Apr 28, 2017
c7255a2
Fixed conflicts
cdaguerre May 16, 2017
baaa2cd
add license file
gimler Jun 1, 2017
e6c0f41
speedup travis build with containers
gimler Jun 5, 2017
f65317e
Merge pull request #193 from gimler/patch-2
m4tthumphrey Jun 6, 2017
9244192
Merge pull request #190 from gimler/patch-1
m4tthumphrey Jun 6, 2017
a572f6b
Merge pull request #185 from donkidd/add_projects_to_groups
m4tthumphrey Jun 6, 2017
51242d8
Merge pull request #187 from violuke/patch-1
m4tthumphrey Jun 6, 2017
10672a0
fix composer.json line endings (dos2unix)
fbourigault Jun 7, 2017
269797b
bump minimum PHP version to 5.6
fbourigault Jun 7, 2017
683108a
add PHP 7.1 to travis-ci matrix
fbourigault Jun 7, 2017
32f7a30
replace psr-0 autoloading by psr-4
fbourigault Jun 7, 2017
07fb0b6
replace phpunit custom bootstrap by autoload-dev
fbourigault Jun 7, 2017
eea2a84
Merge pull request #195 from fbourigault/prepare-9.0
fbourigault Jun 10, 2017
e49bc73
replace buzz by httplug
fbourigault Jun 2, 2017
0a46ae1
Merge pull request #191 from fbourigault/httplug
fbourigault Jul 7, 2017
866532d
Adding the Jobs API
moufmouf Jun 19, 2017
a1174d7
Migrating JobsAPI to use new HTTPlug.
moufmouf Jul 7, 2017
28c8256
set api endpoint to /api/v4
fbourigault Jul 7, 2017
8d9b602
Merge pull request #199 from fbourigault/v4-endpoint
fbourigault Jul 7, 2017
0bd3cd4
Changing method name from "jobs" to "all"
moufmouf Jul 8, 2017
52f2b20
Default value for jobs method and fixing bug in pipeline class
moufmouf Jul 8, 2017
a7bfdc3
Merge pull request #196 from moufmouf/feature/jobs_api
fbourigault Jul 9, 2017
16c6de6
Add approvals, approve & unapprove API's
20uf Jul 10, 2017
a43bb2c
Merge branch 'master' into master
m1guelpf Jul 17, 2017
a1435f4
Merge pull request #201 from 20uf/feat/add-approvals
m1guelpf Jul 17, 2017
63ba9d8
Apply suggested fixes
m1guelpf Jul 17, 2017
a8f80ec
Merge branch 'master' into master
m1guelpf Jul 17, 2017
0d3edb1
Fix Travis
m1guelpf Jul 17, 2017
6a62720
Fix tests
m1guelpf Jul 17, 2017
f8dadc6
Fixed tests
cdaguerre Jul 18, 2017
6cc87d5
Merge pull request #163 from cdaguerre/master
m1guelpf Jul 18, 2017
d455f75
rename branch_name to branch
fbourigault Jul 18, 2017
0974a3d
project fork v4 compatibility
fbourigault Jul 18, 2017
bd2a65f
compatibility with v4 api for Users::block and Users::unblock
fbourigault Jul 18, 2017
7ebed95
remove deprecated keys project endpoints
fbourigault Jul 19, 2017
1d8e771
Merge pull request #203 from m4tthumphrey/suggested-chan
fbourigault Jul 20, 2017
3894235
Merge pull request #205 from fbourigault/v4-api-8936
fbourigault Jul 20, 2017
729e7c0
Merge pull request #206 from fbourigault/v4-api-8940
fbourigault Jul 20, 2017
67c4ffb
Merge pull request #207 from fbourigault/v4-api-9371
fbourigault Jul 20, 2017
1646c36
Merge pull request #210 from fbourigault/v4-api-8716
fbourigault Jul 24, 2017
100ced2
remove expires_at snippet property
fbourigault Jul 19, 2017
a8f75fc
Merge pull request #211 from fbourigault/v4-api-8723
fbourigault Jul 24, 2017
f10591d
update files repository endpoint for v4
fbourigault Jul 24, 2017
c2e2aa0
commits repository v4 api changes
fbourigault Jul 24, 2017
6b86cf0
update show issue for v4
fbourigault Jul 24, 2017
d0b3a07
use issue iid
fbourigault Jul 25, 2017
9b39f0a
replace visibility_level by visibility
fbourigault Jul 25, 2017
fe8df7d
Merge pull request #214 from fbourigault/v4-api-9637
fbourigault Jul 25, 2017
0bdc25a
Merge pull request #215 from fbourigault/v4-api-9679
fbourigault Jul 25, 2017
f4a4742
Merge pull request #216 from fbourigault/v4-api-8967
fbourigault Jul 25, 2017
cd1014b
Merge pull request #217 from fbourigault/v4-api-9530
fbourigault Jul 25, 2017
b1d94c9
Merge branch 'master' into v4-api-9337
fbourigault Jul 25, 2017
b80d826
Merge pull request #218 from fbourigault/v4-api-9337
fbourigault Jul 25, 2017
07ec099
projects collection consolidation
fbourigault Jul 19, 2017
324000b
Merge pull request #213 from fbourigault/v4-api-8962-8877-9674
fbourigault Jul 26, 2017
c267c41
replace merge_request endpoint by merge_requests
fbourigault Jul 25, 2017
dcbc960
remove getList method for MergeRequests api
fbourigault Jul 26, 2017
e6311d8
update merge requests api for v4 api
fbourigault Jul 31, 2017
f317387
remove build related methods in projects api
fbourigault Jul 31, 2017
d7db5ab
remove remaining build references
fbourigault Jul 31, 2017
ea1b976
Merge pull request #221 from fbourigault/v4-api-8793
fbourigault Aug 1, 2017
ba62c92
Merge pull request #222 from fbourigault/v4-api-9463
fbourigault Aug 1, 2017
d97fe4e
fix phpstan level 4 errors
fbourigault Aug 2, 2017
745fee2
run phpstan on travis-ci
fbourigault Aug 2, 2017
a73719b
Merge pull request #225 from fbourigault/static-analysis
fbourigault Aug 2, 2017
2d5e5e3
update coding standards to psr-2
fbourigault Aug 3, 2017
df9ddc3
Merge pull request #226 from fbourigault/psr-2
fbourigault Aug 3, 2017
6e409e8
move sort option outside createOptionsResolver
fbourigault Aug 1, 2017
0f56632
use OptionsResolver in DeployKeys api
fbourigault Aug 1, 2017
42fabca
use OptionsResolver in IssueBoards api
fbourigault Aug 1, 2017
2de90ec
use OptionsResolver in Issues api
fbourigault Aug 1, 2017
f338fc8
Use OptionsResolver in Groups::all
fbourigault Aug 1, 2017
049dba3
Use OptionsResolver in Groups::members
fbourigault Aug 1, 2017
ee2b0e6
Use OptionsResolver in Groups::projects
fbourigault Aug 1, 2017
14f294c
use OptionsResolver in Jobs api
fbourigault Aug 1, 2017
f1c3bb6
use OptionsResolver in Milestones api
fbourigault Aug 1, 2017
78c9c49
use OptionsResolver in ProjectNamespaces api
fbourigault Aug 1, 2017
76f77f6
Use OptionsResolver in Projects::hooks
fbourigault Aug 1, 2017
a7d94b6
Use OptionsResolver in Projects::events
fbourigault Aug 1, 2017
01ee70f
Use OptionsResolver in Projects::deployments
fbourigault Aug 1, 2017
bfd48ac
Use OptionsResolver in Repositories::commits
fbourigault Aug 1, 2017
35bcdae
Use OptionsResolver in Repositories::commitComments
fbourigault Aug 1, 2017
9b22dd4
Typo in UPGRADE.md
fbourigault Aug 1, 2017
016c93c
use OptionsResolver in Users api
fbourigault Aug 1, 2017
6b037a1
Use OptionsResolver in Branch & Project models
fbourigault Aug 3, 2017
4e6800b
remove AbstractApi::PER_PAGE constant
fbourigault Aug 3, 2017
ac66897
add version compatibility table
fbourigault Aug 3, 2017
24baaf0
update badges
fbourigault Aug 3, 2017
16d6b9d
fix put calls + remove unused patch
fbourigault Jul 25, 2017
4322ad4
fix delete calls with parameters
fbourigault Jul 25, 2017
9886de2
Merge pull request #223 from fbourigault/issue-220
fbourigault Aug 3, 2017
9a35ee9
Merge pull request #227 from fbourigault/update-readme
fbourigault Aug 3, 2017
4f5e883
Merge pull request #224 from fbourigault/options-resolver
fbourigault Aug 3, 2017
5759335
use iid instead id on Issue model.
Aug 8, 2017
3b116c1
Merge pull request #229 from cobak78/issue-228
fbourigault Aug 9, 2017
96554de
Add .gitattributes
vinkla Aug 10, 2017
e03905f
Update .gitattributes
vinkla Aug 10, 2017
3335957
Update Laravel link
vinkla Aug 10, 2017
fcf96de
Merge pull request #231 from vinkla/patch-2
m1guelpf Aug 10, 2017
a566479
Merge pull request #230 from vinkla/patch-1
m1guelpf Aug 10, 2017
fac3eac
Fix typo
vinkla Aug 10, 2017
95e059d
Merge pull request #233 from vinkla/patch-1
m1guelpf Aug 10, 2017
d4459e3
use QueryStringBuilder for POST requests
fbourigault Aug 16, 2017
09fe8a6
add createCommit
fbourigault Aug 16, 2017
6edbeb2
add php 7.2 to travis matrix
fbourigault Aug 18, 2017
9dd701c
Merge pull request #235 from fbourigault/php-7.2
fbourigault Aug 18, 2017
8339237
Merge pull request #234 from fbourigault/multi-files-commit
fbourigault Aug 18, 2017
ff18431
Update ProjectHook.php
luceos Aug 22, 2017
4516c1f
Merge pull request #236 from luceos/patch-1
fbourigault Aug 22, 2017
64638fb
fix false boolean query string encoding
fbourigault Aug 25, 2017
7bb056d
Add pagination to load tags
blankse Aug 25, 2017
0707e4a
Merge pull request #238 from blankse/pagination_tags
fbourigault Aug 25, 2017
af99282
Merge pull request #237 from fbourigault/query-string-boolean-encoding
fbourigault Aug 26, 2017
6ae9c05
deprecate merge request comment related methods
fbourigault Aug 28, 2017
84fbf5d
Merge pull request #240 from fbourigault/deprecate-comments
fbourigault Aug 28, 2017
032b7cc
add RepositoryFiles api endpoint
fbourigault Sep 6, 2017
8234385
Merge pull request #241 from fbourigault/repository-files
fbourigault Sep 6, 2017
275a5d4
#242 Gitlab/Model/MergeRequest methods fails on incorrect id usage
KyleWiering Sep 7, 2017
00dbf59
Merge pull request #243 from KyleWiering/Issue-242
fbourigault Sep 8, 2017
41bc13f
#242 Gitlab/Model/MergeRequest methods fails on incorrect id usage
KyleWiering Sep 8, 2017
bf83136
add award_emoji API's
mykiwi Aug 29, 2017
0545bca
add tests
mykiwi Sep 11, 2017
bf8fc46
Merge pull request #245 from mykiwi-forks/feature/award_emoji
fbourigault Sep 11, 2017
699985c
Merge pull request #244 from KyleWiering/Issue-242
fbourigault Sep 11, 2017
65eb670
Issues API: Add support for 'scope' parameter
jwillp Sep 14, 2017
c0e81e6
Merge pull request #247 from jwillp/master
fbourigault Sep 15, 2017
38cf0ed
Added missing property 'start_date' to Milestone model
Sep 18, 2017
65ffd89
Merge pull request #248 from happyproff/add-missing-start_date-to-mil…
m4tthumphrey Sep 18, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
* text=auto

/doc export-ignore
/test export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.styleci.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/README.md export-ignore
/UPGRADE.md export-ignore
1 change: 1 addition & 0 deletions .styleci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
preset: psr2
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
language: php

sudo: false

php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1

matrix:
include:
- php: 7.2
env: STATIC_ANALYSIS=yes

before_script:
- travis_retry composer self-update
- travis_retry composer install --no-interaction --prefer-source
- if [ "$STATIC_ANALYSIS" != "" ]; then curl -L https://github.com/phpstan/phpstan/releases/download/0.8/phpstan.phar -o phpstan.phar; fi;

script:
- vendor/bin/phpunit --verbose --coverage-text
- if [ "$STATIC_ANALYSIS" != "" ]; then php phpstan.phar analyse --level=4 lib; fi;
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Matt Humphrey

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 23 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,44 @@ A PHP wrapper to be used with [Gitlab's API](https://github.com/gitlabhq/gitlabh
==============

[![Build Status](https://travis-ci.org/m4tthumphrey/php-gitlab-api.svg?branch=master)](https://travis-ci.org/m4tthumphrey/php-gitlab-api)
[![StyleCI](https://styleci.io/repos/6816335/shield?branch=master)](https://styleci.io/repos/6816335)
[![Total Downloads](https://poser.pugx.org/m4tthumphrey/php-gitlab-api/downloads?format=flat-square)](https://packagist.org/packages/m4tthumphrey/php-gitlab-api)
[![Latest Stable Version](https://poser.pugx.org/m4tthumphrey/php-gitlab-api/version?format=flat-square)](https://packagist.org/packages/m4tthumphrey/php-gitlab-api)
[![Latest Unstable Version](https://poser.pugx.org/m4tthumphrey/php-gitlab-api/v/unstable?format=flat-square)](//packagist.org/packages/m4tthumphrey/php-gitlab-api)

Based on [php-github-api](https://github.com/m4tthumphrey/php-github-api) and code from [KnpLabs](https://github.com/KnpLabs/php-github-api).

Installation
------------
1. Install Composer

```bash
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
```
Via [composer](https://getcomposer.org)

2. Add the following to your require block in composer.json config.

> Note: be careful when using the `dev-master` tag as this may have unexpected results depending on your version of
Gitlab. See the Versioning section below for more information.

`php composer.phar require m4tthumphrey/php-gitlab-api:dev-master`
```bash
composer require m4tthumphrey/php-gitlab-api php-http/guzzle6-adapter
```

3. Include Composer's autoloader:
Why `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io).

```php
require_once dirname(__DIR__).'/vendor/autoload.php';
```
You can visit [HTTPlug for library users](http://docs.php-http.org/en/latest/httplug/users.html) to get more information about installing HTTPlug related packages.

Versioning
----------

From the 6.0 stable release of Gitlab, I shall now be matching the client version with the Gitlab version. For example
when Gitlab 6.1 is released I will release version 6.1.0 of the API client. If I need to make future updates to the client
before the next API version is released, I'll simply use a 3rd build version - `6.1.1`, `6.1.2` etc for example.
Depending on your Gitlab server version, you must choose the right version of this library.
Please refer to the following table to pick the right one.

It is recommended that you keep your composer file in sync with whatever version of Gitlab you are currently running:
if you are using 6.0, you should require `6.0.*`; 6.1 should be `6.1.*`...
|Version|Gitlab API Version|Gitlab Version|
|-------|------------------|--------------|
|9.x | V4 | >= 9.0 |
|8.x | V3 | < 9.5 |

General API Usage
-----------------

```php
$client = new \Gitlab\Client('http://git.yourdomain.com/api/v3/'); // change here
$client->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN); // change here
$client = \Gitlab\Client::create('http://git.yourdomain.com')
->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN)
;

$project = $client->api('projects')->create('My Project', array(
'description' => 'This is a project',
Expand All @@ -57,8 +54,9 @@ Model Usage
You can also use the library in an object oriented manner:

```php
$client = new \Gitlab\Client('http://git.yourdomain.com/api/v3/'); // change here
$client->authenticate('your_gitlab_token_here', \Gitlab\Client::AUTH_URL_TOKEN); // change here
$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(
Expand All @@ -85,7 +83,7 @@ You get the idea! Take a look around ([API methods](https://github.com/m4tthumph
Framework Integrations
----------------------
- **Symfony** - https://github.com/Zeichen32/GitLabApiBundle
- **Laravel** - https://github.com/vinkla/gitlab
- **Laravel** - https://github.com/vinkla/laravel-gitlab

If you have integrated GitLab into a popular PHP framework, let us know!

Expand Down
90 changes: 90 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# UPGRADE FROM 8.0 to 9.0

Since 9.0, lib no longer use buzz 0.7+, instead it has an HTTPlug abstraction layer.

## `Gitlab\Client` changes

* The constructor no longer allow to specify base url. Use `setUrl` or `Client::create` instead.
* The default url is set to `https://gitlab.com`.
* The `$options` constructor argument have been removed, the `getOption` and `setOption` methods have been removed.
See [documentation](doc/customize.md) to know how to customize the client timeout and how to use a custom user agent.
* The `setBaseUrl` and `getBaseUrl` methods have been removed. Use `setUrl` instead.
* The `clearHeaders` and `setHeaders` methods have been removed. See [documentation](doc/customize.md) to know how use custom headers.
* The `setHttpClient` method have been removed. Use a `Gitlab\HttpClient\Builder` instead.
* The `getHttpClient` method return type is changed to `Http\Client\Common\HttpMethodsClient`.

## `Gitlab\Api\AbstractApi` changes

* The `PER_PAGE` class constant have been removed.

## `Gitlab\Api\DeployKeys` changes

* The `all` method now take a single argument which is an associative array of query string parameters.
* The `ORDER_BY` and `SORT` class constants have been removed.

## `Gitlab\Api\Groups` changes

* The `visibility_level` parameter have been removed from `create` method. Use `visibility` instead.
* The `all` method now take a single argument which is an associative array of query string parameters.
* The `search` method have been removed. Use `all` method instead.
* The `members` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
* The `projects` method second and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Api\Issues` changes

* The second argument of `update`, `remove`, `showComments`, `showComment`, `addComment`, `updateComment`, `removeComment`,
`setTimeEstimate`, `resetTimeEstimate`, `addSpentTime` and `resetSpentTime` methods is now a scoped issue id (iid).
* The `all` method second and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Api\IssueBoards` changes

* The `all` method second and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Api\MergeRequests` changes

* The `getList`, `getByIid`, `merged`, `opened` and `closed` methods have been removed. Use `all` method instead.
* The `ORDER_BY` and `SORT` class constants have been removed.
* The `all` method now take a single argument which is an associative array of query string parameters.
* The `getNotes` method now take only two arguments, the project id and the merge request iid.

## `Gitlab\Api\Milestones` changes

* The `all` method second and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Api\Projects` changes

* The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed.
Use the `deployKeys`, `deployKey`, `addDeployKey`, `deleteDeployKey`, `removeDeployKey` and `enableDeployKey` instead.
* The `ORDER_BY` and `SORT` class constants have been removed.
* The `accessible`, `owned` and `search` methods have been removed. Use `all` method instead.
* The `all` method now take a single argument which is an associative array of query string parameters.
* The `trace` method have been removed. Use `Gitlab\Api\Jobs::trace` instead.
* The `builds` method have been removed. Use `Gitlab\Api\Jobs::all` instead.
* The `build` method have been removed. Use `Gitlab\Api\Jobs::show` instead.
* The `events` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
* The `deployments` method second and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Api\ProjectNamespaces` changes

* The `search` method have been removed. Use `all` method instead.
* The `all` method now take a single argument which is an associative array of query string parameters.

## `Gitlab\Api\Repositories` changes

* The `commitBuilds` method have been removed. Use `Gitlab\Api\Projects::pipelines` instead.
* The `commits` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
* The `commitComments` method third and subsequent arguments have been replaced by a single associative array of query string parameters.

## `Gitlab\Model\Project` changes

* The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed.
Use the `deployKeys`, `deployKey`, `addDeployKey`, `deleteDeployKey`, `removeDeployKey` and `enableDeployKey` instead.

## `Gitlab\Model\Snippet` changes

* The `expires_at` property have been removed.`

## `Gitlab\Model\Users` changes

* The `all` method now take a single argument which is an associative array of query string parameters.
* The `lookup` and `search` methods have been removed. Use `all` method instead.
84 changes: 49 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
{
"name": "m4tthumphrey/php-gitlab-api",
"type": "library",
"description": "GitLab API client",
"homepage": "https://github.com/m4tthumphrey/php-gitlab-api",
"keywords": ["gitlab", "api"],
"license": "MIT",
"authors": [
{
"name": "Matt Humphrey",
"homepage": "http://m4tt.io"
},
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
},
{
"name": "Thibault Duplessis",
"email": "thibault.duplessis@gmail.com",
"homepage": "http://ornicar.github.com"
}
],
"require": {
"php": ">=5.3.2",
"ext-curl": "*",
"ext-xml": "*",
"kriswallsmith/buzz": ">=0.7"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
},
"autoload": {
"psr-0": { "Gitlab\\": "lib/" }
}
}
{
"name": "m4tthumphrey/php-gitlab-api",
"type": "library",
"description": "GitLab API client",
"homepage": "https://github.com/m4tthumphrey/php-gitlab-api",
"keywords": ["gitlab", "api"],
"license": "MIT",
"authors": [
{
"name": "Matt Humphrey",
"homepage": "http://m4tt.io"
},
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
},
{
"name": "Thibault Duplessis",
"email": "thibault.duplessis@gmail.com",
"homepage": "http://ornicar.github.com"
}
],
"require": {
"php": "^5.6 || ^7.0",
"php-http/client-common": "^1.5",
"php-http/client-implementation": "^1.0",
"php-http/discovery": "^1.2",
"php-http/httplug": "^1.1",
"php-http/multipart-stream-builder": "^1.0",
"symfony/options-resolver": "^2.6 || ^3.0"
},
"require-dev": {
"guzzlehttp/psr7": "^1.2",
"php-http/guzzle6-adapter": "^1.0",
"php-http/mock-client": "^1.0",
"phpunit/phpunit": "~4.5"
},
"autoload": {
"psr-4": { "Gitlab\\": "lib/Gitlab/" }
},
"autoload-dev": {
"psr-4": { "Gitlab\\Tests\\": "test/Gitlab/Tests/" }
},
"extra": {
"branch-alias": {
"dev-master": "9.0.x-dev"
}
}
}
28 changes: 28 additions & 0 deletions doc/customize.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Customize `php-gitlab-api`

### How to set custom headers (including `User-Agent`)?

By providing a `Gitlab\HttpClient\Builder` to the `Gitlab\Client` constructor, you can customize the HTTP client.

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

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

$client = new Gitlab\Client($builder);
```
Read more about [HTTPlug plugins here](http://docs.php-http.org/en/latest/plugins/introduction.html#how-it-works).

### How to customize the HTTP client timeout?
As timeout configuration is not compatible with HTTP client abstraction, you have to create the `Gitlab\Client` with
an explicit HTTP client implementation.

```php
$httpClient = Http\Adapter\Guzzle6::createWithConfig([
'timeout' => 1.0
]);
$client = Gitlab\Client::createWithHttpClient($httpClient);
```
Loading