A Laravel package for sending SMS using PayamResan, KaveNegar, and FarazSMS drivers.
- PHP:
>=7.2
- Laravel:
^8.0
,^9.0
,^10.0
Install the package via Composer:
composer require puzzley/sms
-
Publish the Configuration File: Run the following command to publish the
sms.php
config file:php artisan vendor:publish --tag=sms-config
-
Add Environment Variables: Update your
.env
file with the necessary credentials:DEFAULT_SMS_SERVICE=KaveNegar PAYAMRESAN_USERNAME=your-username PAYAMRESAN_PASSWORD=your-password PAYAMRESAN_SERVICE_NUMBER_DEFAULT=XXXX KAVENEGAR_API_KEY=your-api-key KAVENEGAR_SERVICE_NUMBER_DEFAULT=90004803 FARAZSMS_USERNAME=your-username FARAZSMS_PASSWORD=your-password FARAZSMS_SERVICE_NUMBER_DEFAULT=+983000505
-
Set Default Service: The default SMS service can be set in your
.env
file usingDEFAULT_SMS_SERVICE
.
The package provides a unified interface for interacting with different SMS services:
use SMS;
// Sending an SMS
$smsId = SMS::send('09123456789', 'Your message here');
// Using a specific driver
$smsId = SMS::driver('FarazSMS')->send('09123456789', 'Your message here');
// Check Status
$status = SMS::driver('PayamResan')->status($smsId);
// Send Verification Code
SMS::driver('KaveNegar')->sendVerifyCode('09123456789', 'Verification message');
- Mohammad Zare Moghadam
- Amir Reza Rezaei
This package is open-sourced software licensed under the MIT License.