Skip to content

verschoof/bunq-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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