Skip to content

peec/sbanken-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PkjSbankenBundle for Symfony

Create symfony based php apps with integration to Sbanken.

Uses https://github.com/peec/sbanken library. See that for docs of usage.

Install

Add to parameters.yml.dist:

parameters:
    #.......
    sbanken_client_id: ~
    sbanken_client_secret: ~
    sbanken_customer_id: ~

Add to config.yml:

pkj_sbanken:
    client_id: '%sbanken_client_id%'
    client_secret: '%sbanken_client_secret%'
    customer_id: '%sbanken_customer_id%'

Add to AppKernel.php:

    new Pkj\Bundle\SbankenBundle\PkjSbankenBundle()

Run composer require

composer require pkj/sbanken-bundle:^1.0

You will be asked to fill in client_id, client_secret and customer_id. Get these from sbanken website. (customer_id is your person number).

Usage

This bundle exposes a new service pkj_sbanken.client which you have access to getApi().

// Example, this can be run from controllers:

$bankAccountNumber = 11111111111;
$transactionRequest = new TransactionListRequest($bankAccountNumber);

$api = $transactions = $this->get('pkj_sbanken.client')->getApi();
$api->authorize();
$transactions = $api->Transactions()->getList($transactionRequest);
var_dump($transactions);
exit;