timothydc/exact-online-base-client
Composer 安装命令:
composer require timothydc/exact-online-base-client
包简介
Exact Online base client
关键字:
README 文档
README
This package provides a wrapper for the Exact Online API.
Usage
The basic configuration looks like this:
use TimothyDC\ExactOnline\BaseClient\ExactOnlineClient; use TimothyDC\ExactOnline\BaseClient\ClientConfiguration; use TimothyDC\ExactOnline\BaseClient\Authentication\TokenVault; use Psr\Log\LogLevel; $clientConfiguration = new ClientConfiguration( 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx', // client ID 'yyyy', // client secret 'zzzz', // webhook secret 'your-public-callback-url', // redirect URL - should be _exactly_ the same as the URL defined in the EOL app center 'https://start.exactonline.be' // API base URL. Note the ".be" for Belgium ); $tokenVault = new TokenVault(); $tokenVault->setStoragePath('path/to/tokens.json'); $client = new ExactOnlineClient($clientConfiguration, $tokenVault); $client->setLogger($this->logger); // optional logging $client->setDefaultLogLevel(LogLevel::ERROR); // optional log level
Authorization
If you want to start a new authentication process, then call:
$client->startAuthorization();
During the authentication process, EOL will redirect you to your callback URL. There you will need to do:
$client->completeAuthorization('code-from-query-parameters');
Now your $eolClient-object is ready to make API requests:
use Picqer\Financials\Exact\Item; $items = (new Item($client->getConnection()))->get();
Disconnect
If you want to disconnect and delete the access tokens, call the disconnection function on your client.
$client->disconnect();
Internationalisation
If you want to retrieve the language dependent fields in a different language (e.g. Item description and Item long description), call the connection with a language parameter.
use Picqer\Financials\Exact\Item; $items = (new Item($client->getConnection('FR-BE')))->get();
See also the Support\ExactLocale.php file. For more information, see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=LogisticsItems#goodToKnow
Customization
Storage driver
Tokens will be saved, by default, in a json file on the local disk.
To make a custom driver, create a custom Vault class which extends the TokenVaultInterface-interface.
use TimothyDC\ExactOnline\BaseClient\Interfaces\AccessTokenInterface; use TimothyDC\ExactOnline\BaseClient\Interfaces\TokenVaultInterface; class TokenVault implements TokenVaultInterface { public function makeToken(?string $accesToken, ?string $refreshToken, int $expiresAt): AccessTokenInterface { } public function store(AccessTokenInterface $accessToken): void { } public function retrieve(): AccessTokenInterface { } public function clear(): void { } }
And also a custom Token class which extends the AccessTokenInterface-interface.
use TimothyDC\ExactOnline\BaseClient\Interfaces\AccessTokenInterface; class Token implements AccessTokenInterface { public function getAccessToken(): ?string { } public function getRefreshToken(): ?string { } public function getExpiresAt(): int { } }
timothydc/exact-online-base-client 适用场景与选型建议
timothydc/exact-online-base-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.34k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Exact Online」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timothydc/exact-online-base-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timothydc/exact-online-base-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timothydc/exact-online-base-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Component library for ExactTarget API
Aktive-Merchant provides a common interface to process payments using multiple gateways.
Component library for ExactTarget API
Component library for ExactTarget API
A PHP Client for the Exact API
A PHP Client for the Exact API
统计信息
- 总下载量: 1.34k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-11-13