mouyong / puyingcloud-sdk
puyingcloud sdk
dev-master
2020-11-24 06:44 UTC
Requires
- php: >=7.0
- hanson/foundation-sdk: ^2.0|^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.15
- mockery/mockery: ^1.2
- phpunit/phpunit: ~6
This package is auto-updated.
Last update: 2024-09-24 14:46:35 UTC
README
普赢云 sdk.
安装
$ composer require mouyong/puyingcloud-sdk -vvv
使用
use Yan\PuyingCloudSdk\Kernel\ContentFormatter;
require __DIR__.'/vendor/autoload.php';
$sdk = new \Yan\PuyingCloudSdk\PuyingCloudSdk([
'debug' => true, // 必须有,不然 foundation 72 行会报 Notice 未定义索引 debug 错误
'phone' => 'your-phone-number',
'password' => 'your-password',
'log' => [
'file' => __DIR__.'/runtime.log',
'level' => 'debug',
'permission' => 0777,
],
'cache' => new \Doctrine\Common\Cache\FilesystemCache(__DIR__.'/cache/'),
]);
class TestFormatter extends ContentFormatter implements \Yan\PuyingCloudSdk\Contracts\Formatter {
public function format()
{
$title = $this->title($this->content['title']);
$this->result = $title;
}
}
$order = [
'title' => '123',
'desc' => '456',
];
try {
echo json_encode($sdk->printer->createPrintTask($sn, '测试打印', new TestFormatter($order)));
echo json_encode($sdk->printer->getPrinterlist());
} catch (\Exception $e) {
echo $e->getMessage();
}
贡献
您可以通过以下三种方式之一进行贡献:
代码贡献过程并不十分正式。您只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须附有相应的单元测试(如果适用)。
许可证
MIT