chenjiacheng/laravel-tim

腾讯云 即时通信 IM SDK for Laravel

v1.0.3 2022-08-27 15:29 UTC

This package is auto-updated.

Last update: 2025-03-28 06:28:11 UTC


README

腾讯云 即时通信 IM SDK for Laravel

Latest Stable Version Latest Unstable Version Total Downloads License

运行环境

  • PHP >= 8.0.2
  • Composer >= 2.0
  • Laravel || Lumen >= 9.0

安装方式

composer require chenjiacheng/laravel-tim

Laravel

创建服务配置文件

php artisan vendor:publish --provider="Chenjiacheng\LaravelTim\TimServiceProvider"

Lumen

注册服务提供者(需要手动复制配置文件)

$app->register(\Chenjiacheng\LaravelTim\TimServiceProvider::class);

使用示例

<?php

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 [];
    }
}

更多示例请查看 https://github.com/chenjiacheng/tim

License

MIT