Giter Club home page Giter Club logo

laravel-netease's Introduction

Netease

Step1: 安装, composer require "superman2014/netease:1.0.x@dev"

Step2: 注册 Superman2014\Netease\NeteaseServiceProviderconfig/app.php 配置文件:

'providers' => [
    // Other service providers...

    Superman2014\Netease\NeteaseServiceProvider::class,
],

也可以, 添加 Netease 门面 到配置文件的 aliases 数组里:

    'Netease' => Superman2014\Netease\Facades\Netease::class,

Step3: 生成config/netease.php

    php artisan vendor:publish

配置文件内容如下:


<?php

return [
    'app_key' => env('NETEASE_APP_KEY'),
    'app_secret' => env('NETEASE_APP_SECRET'),
];

我们可以在.env文件里面配置这两个常量(网易云信app_key,网易云信app_secret):

NETEASE_APP_KEY,NETEASE_APP_SECRET

Step4: 代码中使用

>>> use Netease;
=> null
>>> $accid = md5(10);
=> "d3d9446802a44259755d38e6d163e820"
>>> $name = 'helloworld';
=> "helloworld"
>>> Netease::createUserId($accid, $name);
=> [
     "code" => 200,
     "info" => [
       "token" => "29df2b6a63bb820271fe66ffeeeebc67",
       "accid" => "d3d9446802a44259755d38e6d163e820",
       "name" => "helloworld",
     ],
   ]
>>>

更多方法参见Superman2014\Netease\NeteaseAPI类,

可用的方法如:createUserId,updateUserId,blockUserId,unblockUserId 等等.

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.