awaiskel / laravel-mysms-15888
This package used to integrate mySMS 15888 service with Laravel Notification Channel
Requires
- php: ^8.0.2|^8.1
- guzzlehttp/guzzle: ^7.2
- illuminate/support: ^9.0|^10.0
This package is not auto-updated.
Last update: 2024-09-30 10:48:30 UTC
README
Getting started
This is unofficial package to integrate mySMS 15888 service with laravel application which enable to send SMS using laravel notification channel.
Obtain API Key at mySMS 15888. If your agency already register, please request from person in charge.
Installation
via composer:
composer require awaiskel/laravel-mysms-15888
Publish mySMS Config File
php artisan vendor:publish --provider="AwaisKel\MySMS\MySMSServiceProvider" --tag="config"
If command above not working, run this command
php artisan vendor:publish
and pick provider "AwaisKel\MySMS\MySMSServiceProvider".
Setting up your configuration
Set your mySMS 15888 API key and endpoint in .env
file :
// .env
...
MYSMS_API_KEY=your_api_key_here
MYSMS_API_ENDPOINT='https://mysmsdvsb.azurewebsites.net/api/messages'
...
In order to let your Notification know which phone are you sending to, the channel will look for the mobile_phone_number
attribute in the Notifiable model (eg. User model). If you want to override the attribute, add the routeNotificationForMySMS
method to your Notifiable model.
public function routeNotificationForMySMS()
{
return $this->custom_phone_number;
}
Usage
Now you can use the channel in your via()
method inside the notification:
use AwaisKel\MySMS\MySMSMessage;
use AwaisKel\MySMS\MySMSChannel;
use Illuminate\Notifications\Notification;
class OrderNotification extends Notification
{
public function via($notifiable)
{
return [MySMSChannel::class];
}
public function toMySMS($notifiable)
{
return MySMSMessage::create()
->keyword('Your Keyword Here')
->message('Your Message Here');
}
}
Reference
Official mySMS API Documentation
Security Vulnerabilities
If you discover a security vulnerability within package, please send an e-mail to Awais Karni via awais@kelantan.gov.my. All security vulnerabilities will be promptly addressed.
License
The MIT License (MIT). Please see License File for more information.