<<<<<<< HEAD 网易云信 服务端sdk for Laravel6. based on laozhangren/neteasy-yunxin. 在此包基础上修复了一些小东西,仅在laravel6中测试可用
Require this package with composer by using the following command:
$ composer require laozhangren/neteasy-yunxin
Then, add the service provider:
If you are using Laravel, add the service provider to the providers array in config/app.php
:
[
'providers' => [
LaoZhangRen\YunXin\YunXinServiceProvider::class,
],
]
as optional, you can use facade:
'aliases' => [
'YunXinHelper' => LaoZhangRen\YunXin\YunXinHelper::class,
],
If you are using Lumen, append the following code to bootstrap/app.php
:
$app->register(LaoZhangRen\YunXin\YunXinServiceProvider::class);
The defaults are set in config/yunxin.php. Copy this file to your own config directory to modify the values. You can publish the config using this command:
php artisan vendor:publish --provider="LaoZhangRen\YunXin\YunXinServiceProvider"
If you are using Lumen, append the following code to 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);
The package is open-sourced software licensed under the MIT license.