oscar-team / sproom
sproom 的 PHP SDK
v1.0.5
2024-03-05 10:10 UTC
Requires
- saloonphp/saloon: ^3.0
README
这是一个用于集成 Sproom api 的 PHP 库
安装
使用包管理器 composer 进行安装。
composer require oscar-team/sproom
使用方法
require __DIR__ . '/vendor/autoload.php'; $client = new \OscarTeam\Sproom\SproomClient(token: 'token', environment: 'test');
注意:请参阅 官方 文档以检查 api 的参数。
子公司 Api
// Get the list of child companies $client->childCompanies()->list(); // Create new child company $client->childCompanies()->create($requestData); // Delete child company $client->childCompanies()->delete($childCompanyId); // Enroll child company $client->childCompanies()->enroll($requestData); // Get child company $client->childCompanies()->get($childCompanyId); // Get child company token $client->childCompanies()->getToken($childCompanyId);
公司 Api
// Search for a company in sproom $client->childCompanies()->search('DK:CVR:1234');
文档 Api
// List all the documents $client->documents()->list(); // Send document to sproom $client->documents()->send($filePath); // Update already sent document $client->documents()->update($documentId, []); // Get sent document format $client->documents()->getFormat($documentId, $format); // Set response for the document $client->documents()->setResponse($documentId, []); // Get response for the document $client->documents()->getResponse($documentId); // Set state of the document $client->documents()->setState($documentId, []); // Get state of the document $client->documents()->getState($documentId);
Peppol 参与者验证 Api
// List all the verifications $client->peppolParticipantVerifications()->list(); // Initiate the verification $client->peppolParticipantVerifications()->initiate([]); // Get the verification $client->peppolParticipantVerifications()->get($verificationId); // Revoke the verification $client->peppolParticipantVerifications()->revoke($verificationId); // Download the verification document $client->peppolParticipantVerifications()->downloadDocument($verificationId, []); // Preview the verification document $client->peppolParticipantVerifications()->previewDocument([]);
收件人 Api
// Check if the recipients can reveie the document $client->recipients()->check('DK:CVR:123'); // Bulk check $client->recipients()->bulkCheck([ 'DK:CVR:123' ]);
Webhook Api
// List all the webhooks $client->webhooks()->list(); // Create new webhook $client->webhooks()->create($requestData); // Delete webhook $client->webhooks()->delete($webhookId); // Update webhook $client->webhooks()->update($requestData); // Get webhook $client->webhooks()->get($webhookId); // Test webhook $client->webhooks()->test($webhookId);
响应
所有 api 都将返回 Saloon 响应类 use Saloon\Http\Response;。请参阅 saloon 的 官方 文档以获取更多详细信息。
贡献
欢迎拉取请求。对于重大更改,请先提出一个问题来讨论您想要更改的内容。
请确保适当地更新测试。