pkj/sbanken-bundle

该包最新版本(1.0.0)没有可用的许可信息。

1.0.0 2018-01-25 21:51 UTC

This package is auto-updated.

Last update: 2024-08-29 04:48:26 UTC


README

使用Sbanken集成创建基于symfony的PHP应用程序。

使用 https://github.com/peec/sbanken 库。请参阅该库的使用文档。

安装

添加到parameters.yml.dist

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

添加到config.yml

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

添加到AppKernel.php

    new Pkj\Bundle\SbankenBundle\PkjSbankenBundle()

运行composer require

composer require pkj/sbanken-bundle:^1.0

您将被要求填写client_id、client_secret和customer_id。从Sbanken网站获取这些信息。(customer_id是您的个人编号)。

使用方法

此包暴露了一个新的服务pkj_sbanken.client,您可以通过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;