Giter Club home page Giter Club logo

neteasy-yunxin's Introduction

neteasy-yunxin


<<<<<<< HEAD 网易云信 服务端sdk for Laravel6. based on laozhangren/neteasy-yunxin. 在此包基础上修复了一些小东西,仅在laravel6中测试可用

Installation

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

Configuration

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

Usage

用户

# 创建用户
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);

License

The package is open-sourced software licensed under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.