jaakkom / procountor-php
关于此包最新版本(dev-master)没有可用的许可证信息。
PHP Procountor 客户端
dev-master
2024-08-13 06:07 UTC
Requires
- php: >=7.2
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- phpunit/phpunit: ^9.0
- squizlabs/php_codesniffer: ^3.5
- vlucas/phpdotenv: ^5.3
This package is auto-updated.
Last update: 2024-09-13 06:20:19 UTC
README
简介
这是一个关于 procountor API 的开源项目
开始
use Procountor\Interfaces\LoggerInterface;
$yourLogger = new class() implements LoggerInterface {....}
$client = new Client($yourLogger);
$client->authenticateByApiKey(
$clientId,
$clientSecret,
$redirectUri,
$apiKey,
$company
);
API 连接
这是连接到发票 API 端点的方式
$invoicesApi = new Invoices($client);
搜索发票
$invoices = $invoicesApi->get();
获取发票
要获取 ID 为 1212 的发票
$invoicesApi->get(1212);
发布新发票
要发布新发票,您首先需要实现自己的适配器
$newInvoice = new class($yourdata) implements \Procountor\Interfaces\Write\Invoice {
private $data;
public function __construct($yourdata) {
$this->data = $yourdata;
}
// then create the related getters:
public function getPartnerId() {
return $this->data->partnerid;
}
// ...etc
}
最后您可以正确发布发票
$invoice = $invoicesApi->post($newInvoice)
开发
关于开发此项目的文档可以在 /doc
目录下找到