PHP code example of jasonwwl / easemob

1. Go to this page and download the library: Download jasonwwl/easemob library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jasonwwl / easemob example snippets




$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');

$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'
    )
));