This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

PHP client for Fenrir Api.

1.0.2 2016-05-13 10:23 UTC

This package is not auto-updated.

Last update: 2021-06-12 01:31:09 UTC


PHP client for Fenrir Api.


Install via composer:

    "require": {
        "canaltp/fenrir-api-client": "~1.0"


Instanciating a client

Instanciate a new client. Your client needs a Guzzle client. Fenrir Api client works with either Guzzle3 or Guzzle5.

use CanalTP\FenrirApiClient\FenrirApi;
use CanalTP\FenrirApiClient\AbstractGuzzle\Version;

$baseUrl = 'http://fenrir-api.local/';

$fenrirApi = new FenrirApi(new Version\Guzzle5($baseUrl)); // For Guzzle 5
$fenrirApi = new FenrirApi(new Version\Guzzle3($baseUrl)); // For Guzzle 3

Or to abstract Guzzle client version, use the factory:

use CanalTP\FenrirApiClient\FenrirApi;
use CanalTP\FenrirApiClient\AbstractGuzzle\GuzzleVersions;

$baseUrl = 'http://fenrir-api.local/';

$fenrirApi = FenrirApi::createWithBaseUrl($baseUrl);

Call Fenrir Api

Retrieve all users:

$users = $fenrirApi->getUsers(); // Returns an array of stdClass.

Retrieve one user:

$user = $fenrirApi->getUser(1); // Returns an stdClass.

Create an user:

$username = 'tyler-durden';
$originId = 2;

$fenrirApi->postUser($username, $originId, [
    'enabled' => true,
    'locked' => '0',

See the complete Fenrir Api client class.


Running tests:

vendor\bin\phpunit -c .


This project is under GPL-3.0 License.