verschoof/bunq-api

An API client that talks to bunq

v2.0.0 2017-06-08 18:23 UTC

This package is not auto-updated.

Last update: 2024-10-27 23:40:24 UTC


README

Build Status

Build Status

Symfony

If you use Symfony see https://github.com/verschoof/bunq-api-bundle

Installation

Require the package

composer require verschoof/bunq-api

Now setup the classes in your DI (example https://github.com/verschoof/bunq-api-bundle/blob/master/src/Resources/config/services.yml).

<?php

use Bunq\Certificate\Storage\FileCertificateStorage;
use Bunq\HttpClientFactory;
use Bunq\Service\DefaultInstallationService;
use Bunq\Service\DefaultTokenService;
use Bunq\Token\Storage\FileTokenStorage;

include __DIR__ . '/vendor/autoload.php';

$bunqCertificateStorage = new FileCertificateStorage('var/data/bunq');

$bunqHttpInstalltionClient = HttpClientFactory::createInstallationClient(
    'https://sandbox.public.api.bunq.com/v1',
        $bunqCertificateStorage
);

$bunqInstallationService = new DefaultInstallationService(
    $bunqHttpInstalltionClient,
    $bunqCertificateStorage,
    'apiKey',
    ['10.0.0.1']
);

$bunqTokenStorage       = new FileTokenStorage('var/data/bunq');
$bunqTokenService       = new DefaultTokenService($bunqInstallationService, $bunqTokenStorage, $bunqCertificateStorage);

$bunqHttpClient = HttpClientFactory::create($bunqCertificateStorage, $bunqTokenService, $bunqCertificateStorage);

$bunqClient = new \Bunq\Client($bunqHttpClient);

Usage

For example to get all users from bunq

$userResource = new \Bunq\Resource\UserResource($bunqClient);
$userResource->listUsers();

Thats about it.

Todo