Download the PHP package meilunzhi/baiwang-sdk without Composer
On this page you can find all versions of the php package meilunzhi/baiwang-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package baiwang-sdk
Baiwang PHP SDK
PHP 7.4 compatible SDK for Baiwang OpenAPI invoice services. The PHP implementation is exposed as a Composer package from php/src; the existing TypeScript source is retained only as a protocol reference.
Requirements
- PHP 7.4
ext-curlext-json
Installation
Install from a published package:
For this repository, generate the local autoloader first:
Basic usage
The equivalent factory entry point is also available:
API methods
| PHP method | Baiwang method |
|---|---|
getToken() |
baiwang.oauth.token |
refreshToken() |
baiwang.oauth.token |
authenticate() |
Reads cache or obtains a token |
invoicing($params) |
baiwang.output.invoice.issue |
queryInvoice($params) |
baiwang.output.invoice.query |
queryLayout($params) |
baiwang.output.format.query |
queryCloudHeadUp($params) |
baiwang.bizinfo.companySearch |
preInvoice($params) |
baiwang.output.preinvoice.issue |
voidInvoiced($params) |
baiwang.output.invoice.cancel |
issueRedLetter($params) |
baiwang.output.redinvoice.issued |
request($method, $params) |
Any supported OpenAPI method |
All business methods take an associative PHP array. Use taxNo or taxId to populate orgId; a configured orgId takes precedence. Successful API envelopes return their data value directly. API errors throw Melon\Baiwang\Exception\ApiException, whose getResponse() method returns the unmodified API response.
Cache adapter
Pass an implementation of Melon\Baiwang\Contracts\CacheInterface as the constructor's third parameter or in cacheProvider. authenticate() stores access_token and refresh_token at baiwang_access_token_{appKey}, using the API's expires_in as the TTL.
HTTP adapter and testing
The default transport is cURL. To supply a framework HTTP client or mock requests, implement Melon\Baiwang\Contracts\HttpClientInterface and return an HttpResponse from post().
All versions of baiwang-sdk with dependencies
ext-curl Version *
ext-json Version *