invoiced / invoiced
Invoiced PHP 库
2.4.2
2023-02-21 16:30 UTC
Requires
- php: >=5.4
- ext-json: *
- ext-mbstring: *
- firebase/php-jwt: ~5.0|~6.0
- guzzlehttp/guzzle: ^6.0|^7.0
Requires (Dev)
- phpstan/phpstan: ^1.4
- phpunit/phpunit: ^4.0|^5.0|^6.0|^7.0|^8.0|^9.0
- yoast/phpunit-polyfills: ^1.0
README
此仓库包含用于 Invoiced API 的 PHP 客户端库。
安装
可以使用 composer 安装 Invoiced 包
composer require invoiced/invoiced
要求
- PHP 5.5+、PHP 7+ 或 PHP 8+
- Composer
使用方法
首先,您必须实例化一个新的客户端
$invoiced = new Invoiced\Client('{API_KEY}');
然后,可以进行如下 API 调用
// retrieve invoice $invoice = $invoiced->Invoice->retrieve('{INVOICE_ID}'); // mark as paid $payment = $invoiced->Payment->create([ 'amount' => $invoice->balance, 'method' => 'check', 'applied_to' => [ [ 'type' => 'invoice', 'invoice' => $invoice->id, 'amount' => $invoice->balance, ], ] ]);
如果您想使用沙箱 API,那么必须在客户端中将第二个参数设置为 true
,如下所示
$invoiced = new Invoiced\Client("{SANDBOX_API_KEY}", true);
开发
可以使用 phpunit
运行测试套件
部署
为了将新版本部署到 Packagist,必须在 GitHub 中创建一个新版本。