PHP code example of zgldh / laravel-kefu5

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

    

zgldh / laravel-kefu5 example snippets


        'kefu5' => [
            'domain' => // 您的云客服平台kf5二级域名地址。如 abc.kf5.com 。不要带 http://, 不要带最后的斜杠
            'token' => // 您的云客服平台的API密钥。 如 '60a0319****7fcdf63461c5ad18106'
        ],
    

       use zgldh\Kefu5\Kefu5;   
  
       $client = (new Kefu5)->withAdmin($adminEmail, $adminPassword);
       $list = $client->tickets()->findAll();
    

       use zgldh\Kefu5\Kefu5;   
  
       $client = (new Kefu5)->withAgent($agentEmail, $agentPassword);
       $list = $client->tickets()->findAll();
    

       use zgldh\Kefu5\Kefu5;   
  
       $client = (new Kefu5)->withEndUser($userEmail);
       $list = $client->requests()->findAll();
    

       use zgldh\Kefu5\Kefu5;   
  
       $username = \Auth::user()->name;
       $redirectURL = (new Kefu5)->sso($username,
           [
               'name'=> '用户昵称|Email',
               'phone'=> '用户的手机',
               'photo'=> '用户的头像地址,必须以http://或https://开头',
               'rememberMe'=> true 表示保持登录的连接时间至30天,false 表示30分钟后无活动自动登录过期
           ]
       );
       
       return redirect($redirectURL);