autojunction/laravel-communication-relay-service
Composer 安装命令:
composer require autojunction/laravel-communication-relay-service
包简介
Laravel Package - Communication Relay Service.
关键字:
README 文档
README
A Laravel package to handle SMS & OTP communication via a central relay service.
✅ Features
- Send OTP messages
- Verify OTP
- Send templated SMS
- Supports hashed OTP type
- Easy integration with environment-based config
📦 Installation
composer require autojunction/laravel-communication-relay-service Install Dev Main composer require autojunction/laravel-communication-relay-service:dev-main
⚙️ Environment Configuration
Add the following variables to your .env file:
CRS_HOST= CRS_API_KEY= CRS_OTP_ENDPOINT= CRS_VERIFY_OTP_ENDPOINT= CRS_SMS_ENDPOINT= CRS_SOURCE=
🚀 Usage
Import the service
use AshokDevatwal\CommunicationRelay\Services\SmsService; $smsService = new SmsService();
📩 Send OTP
$mobile = '911234567890'; $response = $smsService->send('OTP', $mobile);
✅ Verify OTP
$mobile = '911234567890'; $otp = '123456'; $response = $smsService->verifyOtp($mobile, $otp);
✉️ Send SMS (Templated)
$to = '911234567890'; $options = [ 'identifier' => 'welcome_user', // template name 'data' => [ 'user' => 'Raj', 'brand' => 'Mahindra', 'model' => '575 DI' ], ]; $response = $smsService->send('SMS', $to, $options);
🔐 Send Hashed OTP (Optional)
$options = [ 'hash' => 'asdftdf12345', ]; $response = $smsService->send('OTP', '911234567890', $options);
📄 Method Reference
| Method | Description |
|---|---|
send('OTP', $mobile) |
Send OTP |
send('SMS', $mobile, $options) |
Send Template SMS |
verifyOtp($mobile, $otp) |
Verify OTP |
❗ Notes
- Ensure you configure
.envvalues correctly $options['data']must match variables used in your SMS template$options['identifier']is required for SMS type only
👨💻 Author
Ashok Devatwal
统计信息
- 总下载量: 36
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-22