关于php:非官方即时通信-IM支持腾讯IM环信IM极光IM融云IM网易云信IM等

3次阅读

共计 1695 个字符,预计需要花费 5 分钟才能阅读完成。

非官方即时通信 IM,反对腾讯 IM,环信 IM,极光 IM,融云 IM,网易云信 IM 等

装置

composer require whereof/easy-im

申请日志开启

\whereof\easyIm\Kernel\BaseClient::$request_log=true;

案例

腾讯 IM

$config = [
  'appId'      => '5978322198',
  'identifier' => 'administrator',
  'secretKey'  => 'nfugb53xtlhyfq2kgiriganruyoagh93it1zwysmh2tmj5tnnmuqhd2og5ofktjt',
];
$im = whereof\easyIm\Factory::Tencent($config);
// 自定义申请 (账号同步到云端)
$params = [
    'Identifier' => 'easyim',
    'Nick'       => 'easyim',
    'FaceUrl'    => 'https://github.com/whereof/easy-im',
];
$im->request->send('im_open_login_svc/account_import', $params);

环信 IM

$config = [
  'appKey'       => '','clientId'=>'',
  'clientSecret' => '','orgName'=>'',
  'appName'      => '',
];
$im = whereof\easyIm\Factory::Huanxin($config);

// 自定义申请 (账号同步到云端)
$params = [
    'username' => 'easyim',
    'password' => '123456',
    'nickname' => 'easyim'
];
$im->request->send('post', 'users', $params);

极光 IM

$config = ['appKey'       => '','masterSecret'=>'',];
$im = whereof\easyIm\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 = whereof\easyIm\Factory::RongCloud($config);

// 自定义申请 (账号同步到云端)
$params=[
    'userId' => 'easyim',
    'name'   => 'easyim',
];
$im->request->send('user/getToken.json', $params);

网易云信 IM

$config = ['appKey'    => '','appSecret'=>'',];
$im = whereof\easyIm\Factory::Yunxin($config);
// 自定义申请(账号同步到云端)$params = [
    'accid' => 'easyim',
    'name'  => 'easyim',
];
$im->request->send('nimserver/user/create.action', $params);

反对厂商

  • 腾讯 IM
  • 环信 IM
  • 极光 IM
  • 融云 IM
  • 网易云信 IM

退出咱们

如果你认可咱们的开源我的项目,有趣味为 easy-im 的倒退做奉献,竭诚欢迎退出咱们一起开发欠缺。无论是报告谬误或是 Pull Request 开发,那怕是批改一个错别字也是对咱们莫大的帮忙。

对于我

https://github.com/whereof/wh…

许可协定

MIT

正文完
 0