mouyong/puyingcloud-sdk

dev-master 2020-11-24 06:44 UTC

This package is auto-updated.

Last update: 2024-09-24 14:46:35 UTC


README

普赢云 sdk.

TravisCI StyleCI

安装

$ 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();
}

贡献

您可以通过以下三种方式之一进行贡献:

  1. 使用问题跟踪器提交错误报告。
  2. 问题跟踪器上回答问题或修复错误。
  3. 贡献新功能或更新wiki。

代码贡献过程并不十分正式。您只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须附有相应的单元测试(如果适用)。

许可证

MIT