andersevenrud/laravel-frontsms

Laravel 前端 SMS 提供者

0.6.1 2017-06-23 20:29 UTC

This package is auto-updated.

Last update: 2024-09-06 12:57:07 UTC


README

使用 Front 简易发送短信。

包含通知通道、服务提供者和外观。

安装

$ composer require andersevenrud/laravel-frontsms

配置

config/app.php


'providers' => [
    Laravel\FrontSMS\FrontSMSServiceProvider::class,
],

'aliases' => [
  'FrontSMS' => Laravel\FrontSMS\Facades\FrontSMS::class
]

然后发布配置

$ php artisan vendor:publish

现在你有 config/frontsms.php

使用方法

通用

use FrontSMS;

function something() {

  $result = FrontSMS::send(12345678, 'hello world!');

}

通知

use NotificationChannels\FrontSMS\FrontSMSChannel;
use NotificationChannels\FrontSMS\FrontSMSMessage;
use Illuminate\Notifications\Notification;

class ExampleNotification extends Notification
{
    public function via($notifiable)
    {
        return [FrontSMSChannel::class];
    }

    public function toFront($notifiable)
    {
        return FrontSMSMessage::create('12345678', 'Hello world!');
    }
}

变更日志

  • 0.6.1 - 更新 composer.json
  • 0.6.0 - 初次发布

许可

MIT