Giter Club home page Giter Club logo

easemob-1's Introduction

环信 REST API SDK!

部分接口未实现,只做了目前项目上用到的接口,有时间把所有接口全部做出来。

欢迎大家帮我把剩下的接口补充起来。

##Composer 本项目支持Composer安装

$ composer require jasonwwl/easemob

##快速使用 本项目依赖 php-curl-class/php-curl-class

注意easemob/storage目录要可写,因为需要保存token信息

require 'Curl.php';
require 'Easemob.php';

$easemob = new Easemob(array(
  'client_id' => '环信client_id',
  'client_secret' => '环信client_secret',
  'org_name' => 'org_name',
  'app_name' => 'app_name'
));

###创建新用户[授权模式]

$easemob->userAuthorizedRegister('username','password');

###查看用户是否在线

$easemob->userOnline('username');

###向群组中加一个人

$easemob->groupAddUser('group_id','username');

###删除一个用户

$easemob->userDelete('username');

###给指定的群/用户发送消息

考虑到环信的webim目前不支持REST过来的消息读取扩展字段ext,所以下方options数组中可设置mixed键,为trueext的内容会被格式化成JSON字符串并放入消息内容中。

group_id 或 用户username 可为单个String 也可为多个 一维数组

群:

$easemob->sendToGroups('group_id','from who?',array(
    'mixed' => true,
    'ext' => array(
        'a' => 'aa',
        'b' => 'bb'
    )
));

用户:

$easemob->sendToUsers('username','from who?',array(
    'mixed' => true,
    'ext' => array(
        'a' => 'aa',
        'b' => 'bb'
    )
));

目前就实现了这些,其余接口欢迎大家增加。

easemob-1's People

Contributors

jasonwwl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.