emotality/panacea-laravel
Composer 安装命令:
composer require emotality/panacea-laravel
包简介
Laravel package to send transactional SMSes via PanaceaMobile.
README 文档
README
Laravel package to send transactional SMSes via PanaceaMobile.
Minimum Requirements
- PHP 8.1
- Laravel 10
Installation
composer require emotality/panacea-laravelphp artisan vendor:publish --provider="Emotality\Panacea\PanaceaMobileServiceProvider"- Add the following lines to your
.envfile:
PANACEA_USERNAME="<panacea_username>"
PANACEA_PASSWORD="<panacea_password_or_api_key>"
PANACEA_FROM="<from_name>" // Optional
Usage
Sending an SMS to a single recipient:
\PanaceaMobile::sms('+27820000001', "1st Line\n2nd Line\n3rd Line"); // or \PanaceaMobile::sms('+27820000001', "1st Line\n2nd Line\n3rd Line", 'From Name');
Response will be a bool, true if successful, false if unsuccessful.
Sending an SMS to multiple recipients:
\PanaceaMobile::smsMany(['+27820000001', '+27820000002'], "1st Line\n2nd Line\n3rd Line"); // or \PanaceaMobile::smsMany(['+27820000001', '+27820000002'], "1st Line\n2nd Line\n3rd Line", 'From Name');
Response will be an array where the keys are the recipients' numbers, the values will be booleans:
array:2 [▼ "+27820000001" => true "+27820000002" => false ]
Sending an SMS via notification:
namespace App\Notifications; use Emotality\Panacea\PanaceaMobileSms; use Emotality\Panacea\PanaceaMobileSmsChannel; use Illuminate\Notifications\Notification; class ExampleNotification extends Notification { // Notification channels public function via($notifiable) { return [PanaceaMobileSmsChannel::class]; } // Send SMS public function toSms($notifiable) // Can also use toPanacea($notifiable) { // Send SMS without "to", this value will automatically be fetched from // the "routeNotificationForPanacea" method in your notifiable entity. // See the "Routing SMS Notifications" section below. return (new PanaceaMobileSms())->message("1st Line\n2nd Line\n3rd Line"); // or send SMS to a single recipient, specifying the "to" value return (new PanaceaMobileSms()) ->to($notifiable->mobile) // Assuming $user->mobile is their mobile number ->from('From Name') // Optional. Will override config's "from" value. ->message("1st Line\n2nd Line\n3rd Line"); // or send SMS to multiple recipients return (new PanaceaMobileSms()) ->toMany(['+27820000001', '+27820000002']) ->from('From Name') // Optional. Will override config's "from" value. ->message("1st Line\n2nd Line\n3rd Line"); } }
Routing SMS Notifications
To route Panacea notifications to the proper phone number, define a routeNotificationForPanacea method on your notifiable entity:
namespace App\Models; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; class User extends Authenticatable { use Notifiable; /** * Route notifications for the Panacea channel. * * @param \Illuminate\Notifications\Notification $notification * @return string */ public function routeNotificationForPanacea($notification) { return $this->mobile; } }
License
panacea-laravel is released under the MIT license. See LICENSE for details.
emotality/panacea-laravel 适用场景与选型建议
emotality/panacea-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38.28k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 10 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sms」 「laravel」 「panacea」 「transactional sms」 「panaceamobile」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 emotality/panacea-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 emotality/panacea-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 emotality/panacea-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
SDK for payment gateway PlatbaMobilom.sk for PHP7.0
Extensible library for building notifications and sending them via different delivery channels.
yii2-sms expand
Alfabank REST API integration
Panacea SMS gateway package
A fork of simplesoftwareio/simple-sms with Verimor driver.
统计信息
- 总下载量: 38.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-19