PHPackages                             creads/partners-sdk-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. creads/partners-sdk-php

ActiveLibrary[API Development](/categories/api)

creads/partners-sdk-php
=======================

A simple PHP client and CLI for Creads Partners API

1.2.3(7y ago)36.6kMITPHP &gt;=5.4.0

Since Nov 28Compare

[ Source](https://github.com/creads/partners-sdk-php)[ Packagist](https://packagist.org/packages/creads/partners-sdk-php)[ Docs](http://www.creads-partners.com)[ RSS](/packages/creads-partners-sdk-php/feed)WikiDiscussions Synced today

READMEChangelogDependencies (4)Versions (5)Used By (0)

creads/partners-api
-------------------

[](#creadspartners-api)

A simple PHP client and CLI for Creads Partners API.

We recommend to read the [Full API Documentation](https://creads.github.io/partners-doc/) first.

Build StatusCode ClimateDownloadsRelease[![Build Status](https://camo.githubusercontent.com/067e7261687f59414556efa2c3495a8116bda2e6eb536de18c096657e99f3071/68747470733a2f2f7472617669732d63692e636f6d2f6372656164732f706172746e6572732d73646b2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/creads/partners-sdk-php)[![Maintainability](https://camo.githubusercontent.com/f27abf094b046fae2681f0a05eb791c5ce5af494faf262089d8c6c5c177761fa/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f35306164663837663632363239393962393265312f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/creads/partners-sdk-php/maintainability)[![Total Downloads](https://camo.githubusercontent.com/7108990b8dbac4b5853d8c6a4e10f5b29bab0d85cda67fc544e0e5a43a5865f9/68747470733a2f2f706f7365722e707567782e6f72672f6372656164732f706172746e6572732d6170692f646f776e6c6f616473)](https://packagist.org/packages/creads/partners-api)[![Latest Unstable Version](https://camo.githubusercontent.com/f314d61e180a02d86c318e965bd92472c406a7a266c456406f57d0a16bc29363/68747470733a2f2f706f7365722e707567782e6f72672f6372656164732f706172746e6572732d6170692f762f756e737461626c65)](https://packagist.org/packages/creads/partners-api)[![Pingdom Status](https://camo.githubusercontent.com/8e3aeb50f750e816c09aee075e2c70a57fc6e25dfa721ca4d78406a950788b5e/68747470733a2f2f73686172652e70696e67646f6d2e636f6d2f62616e6e6572732f3363656437353330)](http://stats.pingdom.com/hi1jra1p2bc6/2161667)

Use the library in your project
-------------------------------

[](#use-the-library-in-your-project)

### Installation

[](#installation)

The recommended way to install the library is through [Composer](http://getcomposer.org).

Install Composer:

```
curl -sS https://getcomposer.org/installer | php
```

Run the Composer command to install the latest stable version:

```
composer.phar require creads/partners-api
```

### Usage

[](#usage)

After installing, you need to require Composer's autoloader:

```
require 'vendor/autoload.php';
```

First you need to instantiate the Client with an OAuthAuthentication

```
use Creads\Partners\Client;
use Creads\Partners\OAuthAccessToken;

$authentication = new OAuthAuthenticationToken('CLIENT_ID', 'CLIENT_SECRET');
$client = new Client($authentication);
```

Or if you have an access token from somewhere else:

```
use Creads\Partners\Client;
use Creads\Partners\BearerAccessToken;

// Here we get a token
// $authentication = new OAuthAuthenticationToken(...);
// $access_token = $authentication->getAccessToken();
$client = new Client(new BearerAccessToken($access_token));
```

Get information about the API:

```
$response = $client->get('/');
echo json_decode($response->getBody(), true)['version'];
//1.0.0
```

Get information about me:

```
$response = $client->get('me');
echo json_decode($response->getBody(), true)['firstname'];
//John
```

Update my firstname:

```
$client->put('me', [
    'firstname' => 'John'
]);
```

Delete a comment of mine:

```
$client->delete('comments/1234567891011');
```

Create a project:

```
$client->post('projects', [
	'title' => '',
	'description' => '',
	'organization' => '',
    'firstname' => 'John',
    'product' => ''
    'price' => ''
]);
```

Upload a file:

```
    $response = $client->postFile('/tmp/realFilePath.png', 'wantedFileName.png');
```

> The response will expose a `Location` header containing the file url. This url is what you need to reference in a resource to which you want to link this file

```
$theFileUrl = $response->getHeader('Location');

$client->post('projects', [
    // ...
    'brief_files' => [
        $theFileUrl
    ]
]);
```

Download a file:

```
    $client->downloadFile('https://distant-host.com/somefile.png', '/tmp/wantedFilePath.png');
```

### Errors and exceptions handling

[](#errors-and-exceptions-handling)

When HTTP errors occurs (4xx and 5xx responses) , the library throws a `GuzzleHttp\Exception\ClientException` object:

```
use GuzzleHttp\Exception\ClientException;

try {
    $client = new Client([
        'access_token' => $token
    ]);
    $response = $client->get('/unknown-url');
    //...
} catch (ClientException $e) {
    if (404 == $e->getResponse()->getStatusCode()) {
        //do something
    }
}
```

If you prefer to disable throwing exceptions on an HTTP protocol error:

```
$client = new Client([
    'access_token' => $token,
    'http_errors' => false
]);
$response = $client->get('/unknown-url');
if (404 == $e->getResponse()->getStatusCode()) {
    //do something
}
```

Webhooks
--------

[](#webhooks)

You can check the validity of a webhook signature easily:

```
use Creads\Partners\Webhook;

$webhook = new Webhook('your_secret');

if (!$webhook->isSignatureValid($receivedSignature, $receivedJsonBody)) {
    throw new Exception('...');
}
```

Use the CLI application
-----------------------

[](#use-the-cli-application)

### Installation

[](#installation-1)

If you don't need to use the library as a dependency but want to interract with Cread Partners API from your CLI. You can install the binary globally with composer:

```
composer global require creads/partners-api:@dev

```

Then add the bin directory of composer to your PATH in your ~/.bash\_profile (or ~/.bashrc) like this:

```
export PATH=~/.composer/vendor/bin:$PATH

```

You can update the application later with:

```
composer global update creads/partners-api

```

### Usage

[](#usage-1)

Get some help:

```
bin/partners --help

```

Log onto the API (needed the first time):

```
bin/partners login

```

Avoid to type your password each time token expires, using "client\_credentials" grant type:

```
bin/partners login --grant-type=client_credentials

```

Or if you are not allowed to authenticated with "client\_credentials", save your password locally:

```
bin/partners login --save-password

```

Get a resource:

```
bin/partners get /

```

```
{
    "name": "Creads Partners API",
    "version": "1.0.0-alpha12"
}
```

Including HTTP-headers in the output with `-i`:

```
bin/partners get -i /

```

```
200 OK
Cache-Control: no-cache
Content-Type: application/json
Date: Sat, 12 Sep 2015 17:31:58 GMT
Server: nginx/1.6.2
Content-Length: 72
Connection: keep-alive
{
    "name": "Creads Partners API",
    "version": "1.0.0"
}
```

Filtering result thanks to JSON Path (see ). For instance, get only the version number of the API:

```
bin/partners get / -f '$.version'

```

Or get the organization I am member of:

```
bin/partners get /me -f '$.member_of.*.organization'

```

Create a resource:

...

Update a resource:

...

Update a resource using an editor:

```
bin/partners get /me | vim - | bin/partners post /me

```

Update a resource using *Sublime Text*:

```
bin/partners get /me | subl - | bin/partners post /me

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~29 days

Total

4

Last Release

2681d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f8abf06489ebaa309c525e136ffa1ad463682ccd7addff0e7199d903132735a5?d=identicon)[pitpit](/maintainers/pitpit)

---

Top Contributors

[![AlexStef](https://avatars.githubusercontent.com/u/6974094?v=4)](https://github.com/AlexStef "AlexStef (3 commits)")[![JeanLuX](https://avatars.githubusercontent.com/u/43140268?v=4)](https://github.com/JeanLuX "JeanLuX (2 commits)")[![pitpit](https://avatars.githubusercontent.com/u/283481?v=4)](https://github.com/pitpit "pitpit (2 commits)")[![abenevaut](https://avatars.githubusercontent.com/u/1134021?v=4)](https://github.com/abenevaut "abenevaut (1 commits)")[![laupiFrpar](https://avatars.githubusercontent.com/u/435396?v=4)](https://github.com/laupiFrpar "laupiFrpar (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/creads-partners-sdk-php/health.svg)

```
[![Health](https://phpackages.com/badges/creads-partners-sdk-php/health.svg)](https://phpackages.com/packages/creads-partners-sdk-php)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3661.2M46](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
