sbudah/panaceamobile 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

sbudah/panaceamobile

Composer 安装命令:

composer require sbudah/panaceamobile

包简介

PanaceaMobile Notifications driver.

README 文档

README

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Total Downloads

This package makes it easy to send notifications using PanaceaMobile with Laravel 5.3.

Contents

Installation

You can install the package via composer:

composer require sbudah/panaceamobile

You must install the service provider:

// config/app.php
'providers' => [
    ...
    NotificationChannels\PanaceaMobile\PanaceaMobileServiceProvider::class,
];

Setting up the PanaceaMobile service

Create an account at Panacea Mobile and create an API token.

Add your PanaceaMobile login, secret key (hashed password) and default sender name to your config/services.php:

// config/services.php

'panaceamobile' => [
    'login'  => env('PANACEAMOBILE_LOGIN'), // Your Username
    'secret' => env('PANACEAMOBILE_SECRET'), // Your Token
    'sender' => 'Sbudah' // Phone number to send SMS from
]

Usage

You can use the channel in your via() method inside the notification:

use Illuminate\Notifications\Notification;
use NotificationChannels\PanaceaMobile\PanaceaMobileMessage;
use NotificationChannels\PanaceaMobile\PanaceaMobileChannel;

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

    public function toPanaceaMobile($notifiable)
    {
        return (new PanaceaMobileMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}

In order to let your Notification know which phone are you sending/calling to, the channel will look for the phone_number attribute of the Notifiable model. If you want to override this behaviour, add the routeNotificationForPanaceaMobile method to your Notifiable model.

// app/User.php

public function routeNotificationForPanaceaMobile()
{
    return '27111000101';
}

Example #2

<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable;

    /**
     * Route notifications for the Nexmo channel.
     *
     * @return string
     */
    public function routeNotificationForPanaceaMobile()
    {
        return $this->phone;
    }
}

Available methods

  • ->content(''): Specifies the SMS content/text.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固