assoconnect/linxo-client
最新稳定版本:v2.0.0
Composer 安装命令:
composer require assoconnect/linxo-client
包简介
PHP Client for the Linxo API
README 文档
README
PHP Client for the Linxo API
Installation
composer require assoconnect/linxo-client
Documentation
Use the official documentation.
Quick start
<?php use AssoConnect\LinxoClient\AuthClient; // Set up the AuthClient with your credentials $authClient = new AuthClient( 'clientId', 'clientSecret', 'http://your-app.com/linxo/redirect' ); // OAuth2 code exchange $token = $authClient->getTokenFromCode('code'); // OAuth2 token refresh $newToken = $authClient->refreshToken($token->getRefreshToken()); // Get an API Client for a given user identified by its access token $apiClient = $authClient->createApiClient($token->getToken()); $apiClient->getAccounts(); // List of Linxo bank accounts
Tests
This lib ships with a Guzzle system to mock API responses.
It will answer a mocked response if one is defined for a given request, or will call the API.
How to use it
<?php use AssoConnect\LinxoClient\Dto\AccountDto; use AssoConnect\LinxoClient\Test\MockAuthClient; use AssoConnect\LinxoClient\Test\MockFactory; $authClient = new MockAuthClient( 'clientId', 'clientSecret', 'http://your-app.com/linxo/redirect' ); $middleware = $authClient->getMiddleware(); // Create your own mock responses $middleware->stackAccount([ 'id' => '1', 'connection_id' => '2', 'name' => 'My account', 'iban' => 'FR4930003000703896912638U72', 'status' => AccountDto::STATUS_ACTIVE, 'currency' => 'EUR', ]); // You can also mock you or transactions $middleware->stackMe(...); $middleware->stackTransaction(...); $apiClient = $authClient->createApiClient('token'); $apiClient->getAccount('1'); // Will return the mocked DTO $apiClient->getAccount('2'); // Will call the API // Or you can use a factory to get predefined content $factory = new MockFactory($middleware); $factory->mockAccount([ 'name' => 'My 2nd account' // Replace only what you want ]); $factory->mockMe(...); $factory->mockTransaction(...);
统计信息
- 总下载量: 9.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-12-20