Download the PHP package sureshhemal/laravel-sms-sri-lanka without Composer
On this page you can find all versions of the php package sureshhemal/laravel-sms-sri-lanka. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sureshhemal/laravel-sms-sri-lanka
More information about sureshhemal/laravel-sms-sri-lanka
Files in sureshhemal/laravel-sms-sri-lanka
Package laravel-sms-sri-lanka
Short Description A Laravel package for sending SMS through Sri Lankan providers (Hutch, with more providers coming soon)
License MIT
Informations about the package laravel-sms-sri-lanka
Laravel SMS Sri Lanka
A Laravel package for sending SMS through Sri Lankan providers with seamless Laravel notifications integration, built with SOLID principles and clean architecture.
Features
- ✅ Sri Lankan SMS Provider: Hutch (more providers coming soon)
- ✅ Laravel Notifications: Seamless integration with Laravel's notification system
- ✅ SOLID Architecture: Clean, maintainable, and extensible code
- ✅ Provider Agnostic: Easy to switch between providers
- ✅ Configuration Driven: Simple configuration management
- ✅ Type Safe: Full PHP 8.1+ type safety
- ✅ Bulk SMS Support: Send to multiple recipients efficiently
- ✅ Custom Exceptions: Granular error handling for better debugging
- ✅ Modern Testing: Comprehensive test suite with PHPUnit 10+ attributes
Installation
You can install the package via composer:
The package will automatically register its service provider.
Configuration
Publish the configuration file:
This will create config/sms-sri-lanka.php
in your config folder.
Environment Variables
Add these to your .env
file:
Important:
- The
HUTCH_SMS_USERNAME
must be an API user account, not a regular web user account. If you don't have API access, you must contact your Hutch agent to gain API access to your account. - The
HUTCH_SMS_DEFAULT_MASK
refers to the "From" field in the Hutch SMS UI dropdown. You must contact your Hutch agent to get approved masks for your account.
Architecture Overview
The package follows SOLID principles and clean architecture:
Usage
1. Setting Up Your Models
Your models that can receive SMS notifications must implement the ReceivesSmsNotifications
contract:
2. Using Laravel Notifications
Using Package's SmsNotification (Quick Start)
Creating Custom SMS Notifications
For more complex scenarios, create your own notification classes:
3. Direct SMS Service Usage
Note: The to
parameter accepts:
- Single phone number:
'94701234567'
- Multiple phone numbers:
'94701234567,94712345678,94723456789'
(comma-separated)
4. Error Handling
The package provides granular exception handling:
Contracts
ReceivesSmsNotifications
Models that can receive SMS notifications must implement this contract:
SendsSmsNotification
Custom notification classes should implement this contract:
SmsServiceContract
For direct SMS service usage:
Configuration
The package configuration is in config/sms-sri-lanka.php
:
Adding New Providers
The package is designed to be easily extensible. To add a new provider:
-
Create provider-specific classes implementing the contracts:
-
Register in configuration:
- Update environment variables:
Supported Providers
Hutch
- Status: ✅ Available
- API: REST API with OAuth2 authentication
- Features: Delivery reports, campaign tracking
More Providers Coming Soon
- Mobitel: Government integration
- Dialog: Enterprise solutions
- Etisalat: International connectivity
Testing
The package includes comprehensive tests with modern PHPUnit 10+ attributes:
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Suresh Hemal
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-sms-sri-lanka with dependencies
laravel/framework Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/notifications Version ^10.0|^11.0|^12.0
guzzlehttp/guzzle Version ^7.0
guzzlehttp/psr7 Version ^2.0