Looking to hire Laravel developers? Try LaraJobs

laravel-tim maintained by chenjiacheng

Description
腾讯云 即时通信 IM SDK for Laravel
Author
Last update
2022/08/27 17:29 (dev-master)
License
Links
Downloads
15
Tags

Comments
comments powered by Disqus

Tim for Laravel

腾讯云 即时通信 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