Giter Club home page Giter Club logo

yilianyun-php-sdk's Introduction

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://packagist.laravel-china.org

Usage

  1. 接口类Lib/Api/*.php,集成了所有的易联云接口
  2. 配置类Lib/Config/YlyConfig.php
  3. 授权类Lib/Oauth/YlyOauthClient.php,获取调用凭证AccessToken,每日上限次数20次,24小时后更新次数
  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);

yilianyun-php-sdk's People

Contributors

lwygit6826 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.