tagmydoc / sage-accounting-sdk-php
Sage会计PHP SDK
0.1.0
2023-05-02 14:38 UTC
Requires
- sammyjo20/saloon: ^2.6
README
由Saloon(https://github.com/sammyjo20/saloon)提供支持的美丽、可扩展的API。
安装
composer require tagmydoc/sage-accounting-sdk-php
使用
$client = new SageAccountingClient('CLIENT_ID', 'CLIENT_SECRET', route('services/sage'), ['readonly']); $authenticator = AccessTokenAuthenticator::unserialize(get('sage:token')); // The get function is simply a placeholder for you to get the stored access token from your storage if ($authenticator->hasExpired()) { $authenticator = $client->refreshAccessToken($authenticator); // Save the new access token in your storage // The save function is simply a placeholder for you to save the access token to your storage save('sage:token', $authenticator->serialize()); } $client->authenticate($authenticator); $request = CreateContactRequest::make(); $request->body()->add('contact', [ 'name' => 'John Smith' ]); $response = $client->send($request); $contactId = $response->json('id');
鸣谢
许可证
MIT许可证(MIT)。更多信息请参阅许可证文件。