, (*1)
, (*2)
Symfony
If you use Symfony see https://github.com/verschoof/bunq-api-bundle, (*3)
Installation
Require the package, (*4)
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)., (*5)
<?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, (*6)
$userResource = new \Bunq\Resource\UserResource($bunqClient);
$userResource->listUsers();
Thats about it., (*7)
Todo
- [ ] Implement Money object https://github.com/moneyphp/money