定制 johnturingan/route-mobile-laravel-notifications 二次开发

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

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

johnturingan/route-mobile-laravel-notifications

Composer 安装命令:

composer require johnturingan/route-mobile-laravel-notifications

包简介

RouteMobile Notification Channel for laravel.

README 文档

README

A laravel package for sending notifications via route-mobile service.

Installation 🚥

Add the package to your composer.json

"require": {
    ... 
    "johnturingan/route-mobile-laravel-notifications": "{version}"
},

Or just run composer require

$ composer require johnturingan/route-mobile-laravel-notifications

Config 📄

To use this plugin, you need to add the following configuration to your config/services.php file

'route-mobile-notifications' => [
    'host' => 'https://apis.rmlconnect.net',
    'gateway' => \Snp\Notifications\Rml\Services\RouteMobileGateway::class,
    'username' => 'username',
    'password' => 'password',
    'cache' => false // Set to true if you want to cache login response
]

Usage ✅

For full documentation, please refer to Laravel Notification Docs

Sending Notification

To send notification you can use the Laravel Notification Facade and pass the viber mobile number as the first parameter

public function send () 
{
    Notification::send('639057654321', new LeadAddedNotification());
    Notification::send(['639067654321', '639077654321'], new LeadAddedNotification());
}

Formatting Viber Notification

If a notification supports being sent as a Routemobile Viber message, you should define a toRMLViber method on the notification class. This method will receive a $notifiable entity and should return an Snp\Notifications\Rml\Messages\ViberMessage instance. Let's take a look at a basic toRMLViber example:

use Snp\Notifications\Rml\Constants\MessagingMethod;
use Snp\Notifications\Rml\Constants\MessagingType;
use Snp\Notifications\Rml\Messages\ViberMessage;
...

/**
 * Get the Viber representation of the notification.
 *
 * @param  mixed  $notifiable
 * @return Snp\Notifications\Rml\Messages\ViberMessage
 */
public function toRMLViber($notifiable)
{
    return (new ViberMessage('This is a viber message from Laravel'))
            ->setRecipient($recipient)
            ->setType(MessagingType::SINGLE_TEXT)
            ->setMethod(MessagingMethod::ONE_WAY)
            ;
}

NOTE:

If you find any bugs or you have some ideas in mind that would make this better. Please don't hesitate to create a pull request.

If you find this package helpful, a simple star is very much appreciated.

MIT LICENSE
copyright © 2022 Scripts and Pixels.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-04-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固