PHP code example of ccwawamiya / sobot

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

    

ccwawamiya / sobot example snippets



use Ccwawamiya\Sobot\Sobot;
// 获取访问Token
$token = (new Sobot(['app_id'=>'','app_key'=>'']))->token()->getToken();

use Ccwawamiya\Sobot\Sobot;
use Ccwawamiya\Sobot\Contracts\Cache as CacheInterface;

class Cache implements CacheInterface{
    public function set(string $key, $value, $tts): bool
    {
        // TODO 需要实现
    }
    public function get(string $key)
    {
        // TODO 需要实现
    }
    public function exists(string $key): bool
    {
        // TODO 需要实现
    }
}

// 获取访问Token
$token = (new Sobot(['app_id'=>'','app_key'=>''], new Cache()))->token()->getToken();


use Ccwawamiya\Sobot\Sobot;
/** @var \Ccwawamiya\Sobot\OnlineService\QueryAgent\Response $res */
$res = (new Sobot(['app_id'=>'','app_key'=>'']))
->onlineService()
->queryAgent()
->request();