PHP code example of chenjiacheng / laravel-tim

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

    

chenjiacheng / laravel-tim example snippets




namespace App\Http\Controllers;

use Chenjiacheng\Tim\Tim;
use Illuminate\Routing\Controller as BaseController;

class TimController extends BaseController
{
    public function testImport(Tim $tim)
    {
        // 第一种方式
        $result1 = $tim->account->import('101');
        var_dump($result1);
        
        // 第二种方式
        $result2 = app('tim')->account->import('102');
        var_dump($result2);
        
        // 第三种方式
        $result3 = \Chenjiacheng\LaravelTim\Facades\Tim::account()->import('103');
        var_dump($result3);
        
        return [];
    }
}
bash
php artisan vendor:publish --provider="Chenjiacheng\LaravelTim\TimServiceProvider"
bash
$app->register(\Chenjiacheng\LaravelTim\TimServiceProvider::class);