1. Go to this page and download the library: Download yly-openapi/yly-openapi-sdk 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/ */
yly-openapi / yly-openapi-sdk example snippets
//composer下加载方式
lude_once __DIR__ . "/Lib/Autoloader.php";
//初始化配置
use App\Config\YlyConfig;
$config = new YlyConfig('你的应用id', '你的应用密钥');
//v2.0接口需设置请求域名
$config->setRequestUrl('https://open-api.10ss.net/v2');
//获取token
use App\Oauth\YlyOauthClient;
$client = new YlyOauthClient($config);
$token = $client->getToken(); //若是开放型应用请传授权码code
var_dump($token);
//授权打印机(自有型应用使用,开放型应用请跳过该步骤)
use App\Api\PrinterService;
$printer = new PrinterService($token->access_token, $config);
$data = $printer->addPrinter('你的机器码', '你的机器密钥', '机器昵称也可不填', 'gprs卡号没有可不填');
var_dump($data);
//调取文本打印
use App\Api\PrintService;
$print = new PrintService($token->access_token, $config);
$data = $print->index('你的机器码','打印内容排版可看Demo下的callback.php','你的系统内部id自定义32位以内');
var_dump($data);
//调取图形打印
use App\Api\PicturePrintService;
$print = new PicturePrintService($token->access_token, $config);
$data = $print->index('你的机器码','打印内容排版可看Demo下的callback.php','你的系统内部id自定义32位以内');
var_dump($data);
PHP >= 5.4
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.