easyswoole / easy-printer
EasyPrinter for Swoole Coro
1.0.1
2021-04-19 11:47 UTC
Requires
- ext-json: *
- easyswoole/http-client: ^1.5
- easyswoole/spl: ^1.4
- easyswoole/utility: ^1.2
- psr/simple-cache: ^1.0
This package is auto-updated.
Last update: 2024-12-19 19:37:59 UTC
README
全协程支持的云打印机SDK,易于使用的操作接口和风格,轻松推送海量任务至云打印机
目前仅支持易联云,欢迎fork本项目贡献您的力量
安装类库
推荐使用Composer管理依赖,本类库要求Swoole环境,版本>=4.3.0,PHP版本>=7.1即可使用
composer require easyswoole/easy-printer
单文件测试
<?php use EasySwoole\EasyPrinter\Commands\YiLinkCloud\PrintText; use EasySwoole\EasyPrinter\EasyPrinter; require_once 'vendor/autoload.php'; go(function () { $cache = new Cache(); // implements CacheInterface $clientId = '您的易联云应用ID'; $clientSecret = '您的易联云应用秘钥'; $driver = EasyPrinter::yiLinkCloud($clientId, $clientSecret,$cache); // 新建一条命令 $PrintCommand = new PrintText(); $PrintCommand->setMachineCode('打印机编号'); $PrintCommand->setContent('欢迎使用EasyPrinter!'); $PrintCommand->setOriginId(md5(microtime())); try { $response = $driver->sendCommand($PrintCommand); var_dump($response); } catch (Throwable $throwable) { } });