2017 © Pedro Peláez
 

library laravel-sms-manager

provider sms send manager,support aliyun sms and so far.

image

superman2014/laravel-sms-manager

provider sms send manager,support aliyun sms and so far.

  • Tuesday, December 26, 2017
  • by liujingyu
  • Repository
  • 1 Watchers
  • 1 Stars
  • 619 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 5 Versions
  • 13 % Grown

The README.md

SMS

Support Laravel and Lumen., (*1)

Step1: 安装, composer require "superman2014/laravel-sms-manager:1.0.x@dev", (*2)

Step2: 注册 Superman2014\Sms\SmsServiceProviderconfig/app.php 配置文件:, (*3)

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

    Superman2014\Sms\SmsServiceProvider::class,
],

or bootstrap/app.php, (*4)

$app->register(Superman2014\Sms\SmsServiceProvider::class);

也可以, 添加 Sms 门面 到配置文件的 aliases 数组里:, (*5)

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

Step3: 生成config/sms.php, (*6)

    php artisan vendor:publish

配置文件内容如下:, (*7)

<?php

return [

    'default' => 'aliyunsms',

    'sms' => [
        'aliyunsms' => [
            'driver' => 'aliyunsms',
            'client_id' => env('ALIYUN_SMS_CLIENT_ID', null),
            'client_secret' => env('ALIYUN_SMS_CLIENT_SECRET', null),
            'sign_name' => env('ALIYUN_SMS_SIGN_NAME', null), //对应下面,而且是默认签名
            'end_point' => env('ALIYUN_SMS_END_POINT', null),
            'template_codes' => [
                'SMS_1234' => [
                    'name' => '测试验证码',
                    'scopes' => ['captcha'],
                    'sign_name_key' => 'sign_name',//对应上面的sign_name,默认读取sign_name,也可以重定义,便于支持多个不同的签名
                ],
            ],
        ],
    ],
];

我们可以在.env文件里面配置这三个常量(阿里云access_key,阿里云access_secret,短信签名):, (*8)

ALIYUN_SMS_CLIENT_ID,ALIYUN_SMS_CLIENT_SECRET,ALIYUN_SMS_SIGN_NAME, (*9)

Step4: 代码中使用, (*10)

php artisan tinker
Psy Shell v0.7.2 (PHP 7.0.15 — cli) by Justin Hileman

>>> use Sms;
=> null
>>> $paramString = ['captcha' => 1234];
=> [
     "captcha" => 1234,
   ]
>>> $a = Sms::driver()->prepare('18512345678', $paramString, 'SMS_1234')->send();
>>> $a = Sms::driver('aliyunsms')->prepare('18512345678', $paramString, 'SMS_1234')->send();


支持营销短信变量为空
>>> $a = Sms::driver()->prepareV20170606('18512345678', [], 'SMS_1234')->sendV20170606();

Note: superman2014/sms还不是很完善, (*11)

  • [ ] add event
  • [ ] support queue
  • [x] add default
  • [x] sms frequency limit captcha-repository
  • [ ] and so on

The Versions

26/12 2017

dev-master

9999999-dev

provider sms send manager,support aliyun sms and so far.

  Sources   Download

MIT

The Requires

 

by Avatar liujingyu

26/12 2017

v2.0.1

2.0.1.0

provider sms send manager,support aliyun sms and so far.

  Sources   Download

MIT

The Requires

 

by Avatar liujingyu

26/12 2017

v2.0

2.0.0.0

provider sms send manager,support aliyun sms and so far.

  Sources   Download

MIT

The Requires

 

by Avatar liujingyu

29/06 2017

v0.1.1

0.1.1.0

provider sms send manager,support aliyun sms and so far.

  Sources   Download

MIT

The Requires

 

by Avatar liujingyu

10/03 2017

v0.1

0.1.0.0

provider sms send manager,support aliyun sms and so far.

  Sources   Download

MIT

The Requires

 

by Avatar liujingyu