2017 © Pedro Peláez
 

project laravel_send_sms

sms for laravel

image

colyii/laravel_send_sms

sms for laravel

  • Thursday, March 23, 2017
  • by colyii
  • Repository
  • 1 Watchers
  • 2 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ManaSms

基于PhpSms,使用全平台短信服务商。, (*1)

安装

composer require colyii/laravel_send_sms//正式版
composer require colyii/laravel_send_sms:dev-master//开发版

快速上手

1. 配置

  • 配置代理器所需参数

为你需要用到的短信服务商(即代理器)配置必要的参数。可以在config\phpsms.php中键为agents的数组中配置,也可以手动在程序中设置,示例如下:, (*2)

//example:
Sms::agents([
    'Oasms' => [
        'corpAccount' => 'your corpAccount',
        'userAccount' => 'your userAccount',
        'pwd' => 'your api password',
        'url' => 'http://www.oa-sms.com/sendSms.action',
    ],
    'Chuanglan' => [
        'apiAccount' => 'your api key',
        'apiPassword' => 'your api password',
        'clUrl' => 'http://222.73.117.158/msg/HttpBatchSendSM',
    ]
]);
  • 配置可用代理器

配置你的调度方案。可在config\phpsms.php中键为scheme的数组中配置。也可以手动在程序中设置,示例如下:, (*3)

//example:
'scheme' => [
        'Oasms' => [
            '30',
            'agentClass' => 'Colyii\LaravelSms\OasmsAgent',
        ],
        'Chuanglan' => [
            '0 backup',
            'agentClass' => 'Colyii\LaravelSms\ChuanglanAgent',
        ],
        'YunPian' => '0 backup',
    ],

2. 在laravel中使用

如果你只想单纯的在laravel中使用phpsms的功能可以按如下步骤操作, 当然也为你准备了基于phpsms开发的laravel-sms, (*4)

  • 在config/app.php中引入服务提供器
//服务提供器
'providers' => [
    ...
    Toplan\PhpSms\PhpSmsServiceProvider::class,
    Toplan\Sms\SmsManagerServiceProvider::class,
]

//别名
'aliases' => [
    ...
    'PhpSms' => Toplan\PhpSms\Facades\Sms::class,
    'SmsManager' => Toplan\Sms\Facades\SmsManager::class,
]
  • 生成配置文件
php artisan vendor:publish

生成的配置文件为config/phpsms.php,然后在该文件中按提示配置。, (*5)

  • 使用

详见API,示例:, (*6)

PhpSms::make()->to($to)->content($content)->send();

3. 详细使用见

License

MIT, (*7)

The Versions

23/03 2017

dev-master

9999999-dev https://github.com/colyii/laravel_send_sms

sms for laravel

  Sources   Download

MIT

The Requires

 

The Development Requires

  • php >=5.5.0

laravel php sms