laozhangren / neteasy-yunxin
该软件包最新版本(0.0.7)没有可用的许可证信息。
基于 Laravel/lumen 的网易云信服务端 SDK
0.0.7
2021-10-25 09:44 UTC
Requires
- ext-json: *
- guzzlehttp/guzzle: ^6.3
This package is not auto-updated.
Last update: 2024-09-23 23:47:06 UTC
README
<<<<<<< HEAD 网易云信 服务端 SDK for Laravel6,基于 laozhangren/neteasy-yunxin 开发。在此包的基础上修复了一些小问题,仅在 Laravel6 中进行了测试
安装
使用以下命令通过 composer 安装此软件包
$ composer require laozhangren/neteasy-yunxin
然后,添加服务提供者
如果您使用 Laravel,请将服务提供者添加到 config/app.php
文件中的 providers 数组中
[ 'providers' => [ LaoZhangRen\YunXin\YunXinServiceProvider::class, ], ]
可选,您可以使用外观
'aliases' => [ 'YunXinHelper' => LaoZhangRen\YunXin\YunXinHelper::class, ],
如果您使用 Lumen,请将以下代码追加到 bootstrap/app.php
$app->register(LaoZhangRen\YunXin\YunXinServiceProvider::class);
配置
默认值已设置在 config/yunxin.php 中。将此文件复制到您的配置目录以修改值。您可以使用以下命令发布配置
php artisan vendor:publish --provider="LaoZhangRen\YunXin\YunXinServiceProvider"
如果您使用 Lumen,请将以下代码追加到 bootstrap/app.php
$app->configure('yunxin');
使用方法
用户
# 创建用户
YunXinHelper::user()->create($accid, $name, $icon);
# 用户基本信息更新
YunXinHelper::user()->update($accid, $token);
# 封禁用户
YunXinHelper::user()->block($accid);
# 解禁用户
YunXinHelper::user()->unblock($accid);
# 更新用户名片
YunXinHelper::user()->updateUserInfo($accid, $name, $icon);
# 批量获取用户名片
YunXinHelper::user()->getUserInfos($accids);
消息功能
# 文本消息
YunXinHelper::chat()->sendTextMsg($accidFrom, $to, $open, $text);
# 图片消息
YunXinHelper::chat()->sendPictureMsg($accidFrom, $to, $open,
$picName, $picMD5, $picUrl, $picExt, $picWidth, $picHeight, $picSize);
# 批量文本消息
YunXinHelper::chat()->sendTextBatchMsg($accidFrom, $accidsTo, $text);
# 发送自定义系统通知
YunXinHelper::chat()->sendAttachMsg($from, CHAT::CHAT_ONT_TO_ONE, $to, $attach);
许可证
该软件包是开源软件,许可协议为 MIT 许可协议。