rene-roscher/clicksend-laravel
Composer 安装命令:
composer require rene-roscher/clicksend-laravel
包简介
A Laravel package to create SMS messages & Voice calls using ClickSend
README 文档
README
This Laravel package integrates ClickSend for sending SMS and voice messages within Laravel applications, leveraging ClickSend's capabilities for notifications.
Installation
Install via composer:
composer require rene-roscher/clicksend-laravel
Configuration
Add ClickSend credentials in .env and in config/services.php:
.env
CLICKSEND_USERNAME=username
CLICKSEND_PASSWORD=password
config/services.php
'clicksend' => [
'username' => env('CLICKSEND_USERNAME'),
'password' => env('CLICKSEND_PASSWORD'),
],
Usage
Notification Example for SMS and Voice
Simply create a new notification and use the preferred class to send a notification.
Note: Make sure to replace all spaces in the phone number with an empty string.
class TestNotificationClickSend extends Notification { /** * Get the notification's delivery channels. * * @return array<int, string> */ public function via(object $notifiable): array { return ['clicksend-voice', 'clicksend-sms']; // All channels are automatically registered by default } /** * Get the mail representation of the notification. */ public function toClicksendVoice(object $notifiable) // Voice { return ClickSendVoiceMessage::create( message: 'Your Verification Code is: 1234 - I repeat: 1234 - Goodbye!', to: $notifiable->phone_number ); // Or return 'Your Verification Code is: 1234 - I repeat: 1234 - Goodbye!'; } public function toClicksendSms(object $notifiable) // SMS { // Default return ClickSendSmsMessage::create( message: 'Your Verification was approved. Thank you! 🎉', to: $notifiable->phone_number ); // Or a single message return 'Your Verification was approved. Thank you! 🎉'; // Or multiple messages at once return ClickSendSmsMessage::create( message: 'Your Verification was approved. Thank you! 🎉', to: $notifiable->phone_number )->addMessage( message: 'Welcome to our platform! 🎉', to: $notifiable->phone_number ); } }
License
Licensed under the MIT license.
rene-roscher/clicksend-laravel 适用场景与选型建议
rene-roscher/clicksend-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.8k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 02 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rene-roscher/clicksend-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rene-roscher/clicksend-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.8k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-02-16