即时通信 IM,支持腾讯IM,环信IM,极光IM,融云IM,网易云信IM等
This package's canonical repository appears to be gone and the package has been frozen as a result. Email us for help if needed.
    v1.0.0
    2024-01-05 01:56 UTC
Requires
- php: >7.0
- ext-curl: *
- ext-json: *
- ext-zlib: *
- guzzlehttp/guzzle: ^6|^7
- pimple/pimple: ^3.0
This package is not auto-updated.
Last update: 2024-12-07 04:27:00 UTC
README
即时通信SDK im
即时通信SDK,支持腾讯IM,环信IM,极光IM,融云IM,网易云信IM等
安装
composer require laoqianjunzi/im
请求日志开启
\im\Kernel\BaseClient::$request_log=true;
案例
腾讯IM
$config = [
  'appId'      => '5978322198',
  'identifier' => 'administrator',
  'secretKey'  => 'nfugb53xtlhyfq2kgiriganruyoagh93it1zwysmh2tmj5tnnmuqhd2og5ofktjt',
];
$im = im\Factory::Tencent($config);
// 自定义请求(账号同步到云端)
$params = [
    'Identifier' => 'easyim',
    'Nick'       => 'easyim',
    'FaceUrl'    => 'https://github.com/laoqianjunzi/im',
];
$im->request->send('im_open_login_svc/account_import', $params);
环信IM
$config = [
  'appKey'       => '',
  'clientId'     => '',
  'clientSecret' => '',
  'orgName'      => '',
  'appName'      => '',
];
$im = im\Factory::Huanxin($config);
// 自定义请求(账号同步到云端)
$params = [
    'username' => 'easyim',
    'password' => '123456',
    'nickname' => 'easyim'
];
$im->request->send('post', 'users', $params);
极光IM
$config = [
  'appKey'       => '',
  'masterSecret' => '',
];
$im = im\Factory::Jiguang($config);
// 自定义请求(账号同步到云端)
$params = [[
    'username' => 'easyim',
    'password' => '123456',
]];
$im->request->send('post', 'v1/users/', $params);
//IM REST Report V2
//获取消息
$im->request->send('get', 'v2/messages?count=500&begin_time=2015-11-02 10:10:10&end_time=2015-11-02 10:10:12',[],true);
融云IM
$config = [
  'appKey'    => '',
  'appSecret' => '',
];
$im = im\Factory::RongCloud($config);
// 自定义请求(账号同步到云端)
$params=[
    'userId' => 'easyim',
    'name'   => 'easyim',
];
$im->request->send('user/getToken.json', $params);
网易云信IM
$config = [
  'appKey'    => '',
  'appSecret' => '',
];
$im = im\Factory::Yunxin($config);
// 自定义请求(账号同步到云端)
$params = [
    'accid' => 'easyim',
    'name'  => 'easyim',
];
$im->request->send('nimserver/user/create.action', $params);