Package Data | |
---|---|
Maintainer Username: | haibin2017 |
Maintainer Contact: | me@pinchsun.com (Pinch Sun) |
Package Create Date: | 2020-05-20 |
Package Last Update: | 2020-07-27 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2025-02-06 15:05:58 |
Package Statistics | |
---|---|
Total Downloads: | 15 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 0 |
Total Forks: | 0 |
Total Open Issues: | 0 |
网易云信 服务端sdk for Laravel5 / Lumen. based on salamander-mh/YunXinHelper.
Require this package with composer by using the following command:
$ composer require haibin2017/easy-yunxin
Then, add the service provider:
If you are using Laravel, add the service provider to the providers array in config/app.php
:
[
'providers' => [
Woshuo\YunXin\YunXinServiceProvider::class,
],
]
Laravel 5.5+ 会自动注册服务提供者可过滤
If you are using Lumen, append the following code to bootstrap/app.php
:
$app->register(Woshuo\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="Woshuo\YunXin\YunXinServiceProvider"
If you are using Lumen, append the following code to bootstrap/app.php
:
$app->configure('yunxin');
use Woshuo\YunXin\Entrance;
$appKey = config('yunxin.app_key');
$appSecret = config('yunxin.app_secret');
$helper = new Entrance($appKey, $appSecret);
$user = $helper->user();
$chat = $helper->chat();
# 创建用户
$user->create($accid, $name, $icon);
# 用户基本信息更新
$user->update($accid, $token);
# 封禁用户
$user->block($accid);
# 解禁用户
$user->unblock($accid);
# 更新用户名片
$user->updateUserInfo($accid, $name, $icon);
# 批量获取用户名片
$user->getUserInfos($accids);
# 文本消息
$chat->sendTextMsg($accidFrom, $to, $open, $text);
# 图片消息
$chat->sendPictureMsg($accidFrom, $to, $open,
$picName, $picMD5, $picUrl, $picExt, $picWidth, $picHeight, $picSize);
# 批量文本消息
$chat->sendTextBatchMsg($accidFrom, $accidsTo, $text);
# 发送自定义系统通知
$chat->sendAttachMsg($from, CHAT::CHAT_ONT_TO_ONE, $to, $attach);
The package is open-sourced software licensed under the MIT license.