PHP code example of shayvmo / feieyun

1. Go to this page and download the library: Download shayvmo/feieyun 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/ */

    

shayvmo / feieyun example snippets


$username = 'username';
$u_key = 'u_key';

$feieyun = new \Shayvmo\Feieyun\FeiEYun($username, $u_key);

// 各个接口定义私有参数
$private_params = ['sn' => '打印机编号'];

// 方式1,设置公共参数apiname, eg: Open_queryPrinterStatus
$response_data = $feieyun->setApiName('Open_queryPrinterStatus')->request($private_params);

// 方式2,使用已定义的接口类
$response_data = $feieyun->checkPrinterStatus($private_params);

use Shayvmo\Feieyun\FeiEYun;

class FeiEYunController extends Controller
{
    public function show(FeiEYun $feiEYun)
    {
        return response()->json($feiEYun->checkPrinterStatus(['sn'=>'xxx']));
    }
}

class FeiEYunController extends Controller
{
    public function show()
    {
        return response()->json(app('feieyun')->checkPrinterStatus(['sn'=>'xxx']));
    }
}

$response = $feieyun->checkPrinterStatus(['sn'=>'xxxxx']);