PHP code example of easyswoole / easy-printer
1. Go to this page and download the library: Download easyswoole/easy-printer library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
easyswoole / easy-printer example snippets
use EasySwoole\EasyPrinter\Commands\YiLinkCloud\PrintText;
use EasySwoole\EasyPrinter\EasyPrinter;
�云应用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) {
}
});