roomies/vonage-voice-channel
Composer 安装命令:
composer require roomies/vonage-voice-channel
包简介
Send Laravel notifications through a phone call
README 文档
README
This package provides a notification channel for the Laravel framework that works with Vonage's voice API, allowing text-to-speech phone calls. It also provides a fluent interface to construct your message content.
Installation
You can install the package via Composer:
composer require roomies/vonage-voice-channel
Under the hood we use laravel/vonage-notification-channel to configure Vonage, so make sure you have it properly configured using Vonage environment variables. However, in order to make voice calls you need to provide additional credentials in your environment. Note that the private key can be a string or path to the key file.
VONAGE_APPLICATION_ID= VONAGE_PRIVATE_KEY=
Then add your call from number and voice to config/services.php under the vonage key. You can review the available voices in the Vonage documentation.
'vonage' => [ 'call_from' => env('VONAGE_CALL_FROM'), 'call_language' => env('VONAGE_CALL_LANGUAGE', 'en-US'), 'call_style' => env('VONAGE_CALL_STYLE', 0), ],
Usage
Simply route a notification through the VoiceChannel and return a formatted message from the toVoice method. You use a string with your own Speech Synthesis Markup Language (SSML) or use the the included wrapper API to build up your message.
use Roomies\VonageVoiceChannel\Markup\Message; use Roomies\VonageVoiceChannel\Markup\SayAs; use Roomies\VonageVoiceChannel\Markup\Sentence; use Roomies\VonageVoiceChannel\VonageVoiceChannel; /** * Get the notification's delivery channels. * * @param mixed $notifiable * @return array */ public function via($notifiable) { return [VonageVoiceChannel::class]; } /** * Get the voice representation of the notification. * * @param mixed $notifiable * @return \Roomies\VonageVoiceChannel\Markup\Message */ public function toVoice($notifiable) { return new Message([ new Sentence('Hi, thanks for joining Roomies.'), new Sentence([ 'Your verification code is', (new SayAs('ABC123'))->interpretAs('spell-out') ]), ]); }
Markup
There are a handful of different markup types available to get the right message you're after. Here are some additional examples, otherwise browse src/Markup to see all the available options.
new Paragraph([ new Sentence('This is the first sentence of a paragraph.'), ]); new Sentence([ 'Hey!', (new Pause)->time('1s'), (new Prosody('Wake up!'))->volume('loud'), (new Substitution( (new SayAs('US'))->interpretAs('spell-out'), ))->alias('United States'), ])
Custom
Alternatively, you're free to just return your own SSML markup as a string. This gives you complete control if you need something more custom or have more complex requirements.
/** * Get the voice representation of the notification. * * @param mixed $notifiable * @return string */ public function toVoice($notifiable) { return '<speak> <s>Hi, thanks for joining Roomies</s> <s>Your verification code is <say-as interpret-as="spell-out">ABC123</say-as></s> <speak>'; }
License
The MIT License (MIT). Please see License File for more information.
roomies/vonage-voice-channel 适用场景与选型建议
roomies/vonage-voice-channel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.56k 次下载、GitHub Stars 达 53, 最近一次更新时间为 2022 年 02 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「roomies」 「laravel-notification-channel」 「vonage-voice-channel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 roomies/vonage-voice-channel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 roomies/vonage-voice-channel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 roomies/vonage-voice-channel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A laravel notification channel to deliver sms using the Orange SMS Api
This package makes it easy to send notifications via AfricasTalking with Laravel
Send Laravel notifications through a phone call
Gather insights and verify phone numbers from multiple third-party providers.
Geolocate IP addresses using a variety of third-party services
Integrate your Laravel app with AWS Fraud Detector
统计信息
- 总下载量: 9.56k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 53
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-10