PHP code example of nizerin / yun-xin-helper

1. Go to this page and download the library: Download nizerin/yun-xin-helper 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/ */

    

nizerin / yun-xin-helper example snippets


$appKey = '****'; // 网易云信分配的账号
$appSecrt = '****'; // 网易云信分配的密钥
$entrance = new \YunXinHelper\Entrance($appKey, $appSecrt);

# 创建用户
$entrance->user()->create($accid, $name, $icon);

# 用户基本信息更新
$entrance->user()->update($accid, $token);

# 封禁用户
$entrance->user()->block($accid);

# 解禁用户
$entrance->user()->unblock($accid);

# 更新用户名片
$entrance->user()->updateUserInfo($accid, $name, $icon);

# 批量获取用户名片
$entrance->user()->getUserInfos($accids);

# 文本消息
$entrance->chat()->sendTextMsg($accidFrom, $to, $open, $text);

# 图片消息
$entrance->chat()->sendPictureMsg($accidFrom, $to, $open,$picName, $picMD5, $picUrl, $picExt, $picWidth, $picHeight, $picSize);

# 批量文本消息
$entrance->chat()->sendTextBatchMsg($accidFrom, $accidsTo, $text);

# 发送自定义系统通知
$entrance->chat()->sendAttachMsg($from, CHAT::CHAT_ONT_TO_ONE, $to, $attach);