colyii / laravel_send_sms by colyii

sms for laravel
56
2
2
Package Data
Maintainer Username: colyii
Maintainer Contact: colyii@icloud.com (colyii)
Package Create Date: 2016-08-24
Package Last Update: 2017-03-23
Language: PHP
License: MIT
Last Refreshed: 2024-12-19 03:23:43
Package Statistics
Total Downloads: 56
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 2
Total Open Issues: 0

ManaSms

基于PhpSms,使用全平台短信服务商。

安装

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

快速上手

###1. 配置

  • 配置代理器所需参数

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

//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的数组中配置。也可以手动在程序中设置,示例如下:

//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

  • 在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,然后在该文件中按提示配置。

  • 使用

详见API,示例:

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

###3. 详细使用见

License

MIT