定制 avlima/laravel-sms-mmcenter 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

avlima/laravel-sms-mmcenter

Composer 安装命令:

composer require avlima/laravel-sms-mmcenter

包简介

MMCenter SMS notification service for Laravel

README 文档

README

Packagist GitHub license

Integrate SMS MMCenter with Laravel

MMCenter SMS notification service for Laravel.

Star ⭐ repo to show suport 😊

Installation

Install Package

Require this package with composer:

composer require avlima/laravel-sms-mmcenter

Add Service Provider & Facade

For Laravel 5.5+

Once the package is added, the service provider and facade will be autodiscovered.

For Older versions of Laravel

Add the ServiceProvider to the providers array in config/app.php:

Avlima\SmsMMCenter\Providers\SmsMMCenterServiceProvider::class,

Add the Facade to the aliases array in config/app.php:

'SmsMMCenter': Avlima\SmsMMCenter\Facades\SmsMMCenterFacade::class,

Publish Config

Once done, publish the config to your config folder using:

php artisan vendor:publish --provider="Avlima\SmsMMCenter\Providers\SmsMMCenterServiceProvider"

Configuration

Add the keys in .env:

MMCENTER_USER=
MMCENTER_PASSWORD=
MMCENTER_TIMEOUT=60
MMCENTER_URL=http://www.mmcenter.com.br/mmenvio.aspx,
MMCENTER_OPERATION=ENVIO
MMCENTER_ROUTE=

Once the config file is published, open config/sms-mmcenter.php

Usage

Using SmsMMCenter facade

  • Basic Usage SmsMMCenter::sendMessage("TO","MESSAGE");

Use in Notifications

Setting up the Route for Notification

Add the method routeNotificationForSmsMMCenter() to your Notifiable model:

public function routeNotificationForSmsMMCenter() {
        return $this->phone; //Name of the field to be used as mobile
    }    

By default, your User model uses Notifiable.

Setting up Notification

Add

use Avlima\SmsMMCenter\Notifications\SmsMMCenterChannel;

and

use Avlima\SmsMMCenter\Notifications\SmsMMCenterMessage;

to your notification.

You can create a new notification with php artisan make:notification NOTIFICATION_NAME

In the via function inside your notification, add return [SmsMMCenterChannel::class]; and add a new function toSmsMMCenter($notifiable) to return the message body and parameters.

Notification example:-

namespace App\Notifications;

use Avlima\SmsMMCenter\Notifications\SmsMMCenterChannel;
use Avlima\SmsMMCenter\Notifications\SmsMMCenterMessage;
use Illuminate\Notifications\Notification;

class ExampleNotification extends Notification
{
    public function via($notifiable)
    {
        return [SmsMMCenterChannel::class];
    }
    
    public function toSmsMMCenter($notifiable)
    {
        return (new SmsMMCenterMessage)
            ->to("44999999999")
            ->content("Hello");
    }
}

Support

Feel free to post your issues in the issues section.

Credits

Developed by Alberto Lima

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固