承接 tarre/laravel-46elks 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tarre/laravel-46elks

最新稳定版本:1.4.5

Composer 安装命令:

composer require tarre/laravel-46elks

包简介

A wrapper for php-46elks

README 文档

README

About Laravel-46Elks

Laravel-46Elks is a SMS notification driver for Laravel Notifications, written to streamline the interaction between 46elks API and your Laravel application. For generic PHP usage, please check out php-46elks instead.

Installation

Install with composer

composer require tarre/laravel-46elks

Publish config

php artisan vendor:publish --tag="laravel-46elks"

Adjust config

Add this to your .env file

e46ELKS_FROM=MyApp
e46ELKS_USERNAME=xxx
e46ELKS_PASSWORD=yyy
e46ELKS_DRY_RUN=false
e46ELKS_WHEN_DELIVERED=false

Example usage

User model

class User Extends Model
{
    use Notifiable;

    public function routeNotificationFor46elks()
    {
        return '+46701474417'; // could also be an array of strings ['number1', 'number2'] etc
    }
}

Notification

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Tarre\Laravel46Elks\Messages\SmsMessage;

class TestNotification extends Notification
{
    use Queueable;

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed  $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return ['46elks'];
    }


    /**
     * Send the message via 46elks
     *
     * @param mixed $notifiable
     * @return SmsMessage
     */
    public function to46elks($notifiable)
    {
        return (new SmsMessage)
            ->line('Hello ' . $notifiable->name)
            ->line('') // will produce new line
            ->line('Wsup?');
    }
}

If you are using toMail already, check out Piggybacking on Notifications toMail method

Available SmsMessage methods

  • __construct(array $lines) Alternative to ->line('')
  • ->line($line) Add text message line
  • from($senderId) Overrides the .env file
  • cc($e164Number) Add more e164 recipients
  • whenDelivered($url) Overrides the .env file
  • flash($state = true) Flash SMS are shown immediately on the receivers phone and do not disappear until the receiver has confirmed the message. This feature is perfect for messages that really have to be read by the receiver.

More

统计信息

  • 总下载量: 1.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固