Code Monkey home page Code Monkey logo

send_message_by_aliyun_for_laravel5's Introduction

SendMessage_by_Aliyun_for_Laravel5

use Aliyun SDK to send messages for Laravel 5

安装  

在终端输入以下命令进行安装

composer require lichmaker/send_message_by_aliyun_for_laravel5 dev-master

配置

config/app.php中的相应位置,添加以下代码:

  'providers' => [
  
  ......
  
  Lichmaker\MessagesSender\MessagesSenderServiceProvider::class,
  ],
  
  'aliases' => [
  
  ......
  
  'MessagesSender' => Lichmaker\MessagesSender\Facade\MessagesSenderFacade::class,
  ],

.env文件中,添加阿里云的accesskeyID和accesskeySECRET

ALIYUN_ACCESSKEYID=(填入阿里云账户accesskeyID)
ALIYUN_ACCESSKEYSECRET=(填入阿里云账户accesskeySECRET)

使用方法

1、使用前请先前往阿里云官网开通短信发送服务,获取短信模板代码和短信签名。

2、使用例子:

use MessagesSender;

class HomeController extends Controller
{
    public function home()
    {
        $demo = new MessagesSender();

        $response = $demo::sendSms(
            "短信签名", // 短信签名
            "SMS_*******", // 短信模板编号
            "15602******", // 短信接收者
            Array(  // 短信模板中字段的值
                "name"=>"lichmaker",
                "score"=>"1",
                "code" =>"1234"
            )
        );
        
        //打印发送成功or失败回调
        print_r($response);
    }
}

3、还有更多其他功能将会在以后的更新推出

send_message_by_aliyun_for_laravel5's People

Contributors

lichmaker avatar

Stargazers

Qibin Liang avatar  avatar

Watchers

 avatar

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.