glhcp/server/vendor/yly-openapi/yly-openapi-sdk
yin5th 0921f0105d feat: init 2023-08-10 14:59:52 +08:00
..
Demo feat: init 2023-08-10 14:59:52 +08:00
Lib feat: init 2023-08-10 14:59:52 +08:00
.gitignore feat: init 2023-08-10 14:59:52 +08:00
.travis.yml feat: init 2023-08-10 14:59:52 +08:00
README.md feat: init 2023-08-10 14:59:52 +08:00
composer.json feat: init 2023-08-10 14:59:52 +08:00
phpunit.xml feat: init 2023-08-10 14:59:52 +08:00

README.md

yilianyun-php-sdk

Build Status

Requirement

PHP >= 5.4

Installation

composer require yly-openapi/yly-openapi-sdk:v1.0.1

若composer失败请换到国内镜像

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

Usage

  1. 接口类Lib/Api/*.php集成了所有的易联云接口
  2. 配置类Lib/Config/YlyConfig.php
  3. 授权类Lib/Oauth/YlyOauthClient.php获取调用凭证AccessToken每日上限次数小时后更新次数
  4. 接口调用类Lib/Protocol/YlyRpcClient.php包括了md5工具函数Sign工具函数uuid函数可以直接用这个类直接进行接口调用
  5. 若觉的好用,大佬们请在GitHub上给子陌一个Star在此子陌先感谢各位大佬抱拳子陌也会时长更新接口的为大佬们提供方便
<?php
//composer下加载方式
include_once __DIR__ . "/vendor/autoload.php";

//gitHub下载加载方式
include_once __DIR__ . "/Lib/Autoloader.php";

//初始化配置
use App\Config\YlyConfig;
$config = new YlyConfig('你的应用id', '你的应用密钥');

//获取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);