v1.9.0 2018-03-09 11:55 UTC


Getting started

Install dependencies:

Get PHP dependencies using Composer

composer install


Setup environment variables

Before running the examples, make sure the following environment variables have been configured:

export HUB_URL=""
export HUB_V1_USERNAME=joe
export HUB_V1_PASSWORD=secret
export HUB_V3_USERNAME=joe
export HUB_V3_PASSWORD=secret

Hub v1 and v3 use different authentication methods, therefor you can specify them separately.

Note, the v1 credentials are also used to access resources at providers for v1 security hashes.

You can use a .env file, by copying the .env.dist to .env and updating it with your credentials.

Run the examples

php examples/v1/getdossierinfo.php {bsn}
php examples/v3/search.php client_bsn=987654321

Build the v4 API client

The v4 API Client authenticates itself with the Hub using a Json Web Token (JWT) which it obtains from UserBase. The username and password you usually use to authenticate with the Hub are used to authenticate with UserBase and obtain a JWT. Thereafter, the v4 client is used in the same way as the v3 client.

use Hub\Client\Exception\ClientCreationException;
use Hub\Client\Exception\ResponseException;
use Hub\Client\Factory\ApiClientFactory;

require_once '/path/to/vendor/autoload.php';

$userbaseUrl = '';
$hubUrl = '';
$username = 'my-username';
$password = 'my-password';

$clientFactory = new ApiClientFactory($hubUrl);
try {
    $client = $clientFactory->createV4Client($username, $password);
} catch (ClientCreationException $e) {
    // failed to create the client: probably failed to obtain a JWT
    echo $e->getMessage() . PHP_EOL;
try {
    $resources = $client->findResources();
} catch (ResponseException $e) {
    echo $e->getMessage() . PHP_EOL;


For Guzzle versions > 4, curl is used to verify remote SSL connections. In order for this to work, you'll need to pass a verify key to guzzle, pointing to a .pem file containing all trusted CA's.

These are published by curl here:

If needed, you can download new ca certificates from there, and put them in the root of this project.


MIT. Please refer to the included file