定制 hafael/totalvoice-notification-channel 二次开发

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

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

hafael/totalvoice-notification-channel

Composer 安装命令:

composer require hafael/totalvoice-notification-channel

包简介

TotalVoice Notification Channels for Laravel 5.3+

README 文档

README

Latest Version on Packagist Software License Build Status StyleCI SymfonyInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send TotalVoice Notifications with Laravel 5.3+.

Contents

Installation

You can install the package via composer:

composer require hafael/totalvoice-notification-channel

Add the service provider (only required on Laravel 5.4 or lower):

// config/app.php
'providers' => [
    ...
    NotificationChannels\TotalVoice\TotalVoiceServiceProvider::class,
],

Setting up the TotalVoice service

Add your TotalVoice Access Token to your config/services.php:

// config/services.php
...
'totalvoice' => [
    'access_token' => env('TOTALVOICE_ACCESS_TOKEN'),
],
...

Usage

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

use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceSmsMessage;
use Illuminate\Notifications\Notification;

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

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

You can also send an TTS (text-to-speech) audio call:

use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceTtsMessage;
use Illuminate\Notifications\Notification;

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

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

Or create a TotalVoice audio call from .mp3 file url:

use NotificationChannels\TotalVoice\TotalVoiceChannel;
use NotificationChannels\TotalVoice\TotalVoiceAudioMessage;
use Illuminate\Notifications\Notification;

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

    public function toTotalVoice($notifiable)
    {
        return (new TotalVoiceAudioMessage())
            ->content("http://foooo.bar/audio.mp3");
    }
}

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 routeNotificationForTotalVoice method to your Notifiable model.

public function routeNotificationForTotalVoice()
{
    return '+5521999999999';
}

Available Message methods

TotalVoiceSmsMessage (SMS)

  • provideFeedback(false): Wait for recipient feedback.
  • multipart(false): Supports SMS with > 160 < 16,000 char. Sends multiple sms up to 160char to the same number.
  • scheledule(new \DateTime()): date and time to schedule the sms delivery. null as default sends immediately.
  • content(''): Accepts a string value for the notification body.

TotalVoiceTtsMessage (Text-to-speech audio call)

  • provideFeedback(false): Wait for recipient feedback.
  • fakeNumber(null): Accepts a phone to use as the notification sender.
  • recordAudio(false): Save the call.
  • detectCallbox(false): Automatically disconnects within 3 seconds if it falls into the mailbox (vivo, claro, tim, oi).
  • speed(0): From -10 to 10. When -10=very slow, 0=normal and 10=very fast.
  • voiceType('br-Vitoria'): language-Character acronym who will speak.
  • content(''): Accepts a string value for the notification body.

TotalVoiceAudioMessage (.mp3 audio call)

  • provideFeedback(false): Wait for recipient feedback.
  • fakeNumber('+5521999999999'): Accepts a phone to use as the notification sender.
  • recordAudio(false): Save the call.
  • detectCallbox(false): Automatically disconnects within 3 seconds if it falls into the mailbox (vivo, claro, tim, oi).
  • content('http://foooo.bar/audio.mp3'): Accepts an .mp3 file url for the call.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

If you discover any security related issues, please email villa655321verde@gmail.com instead of using the issue tracker.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固