Laravel notification channel for WinSMS API
shipper/laravel-winsms-channel is a Laravel package for laravel notification channel for winsms api.
It currently has 0 GitHub stars and 36.051 downloads on Packagist (latest version v1.1.4).
Install it with composer require shipper/laravel-winsms-channel.
Discover more Laravel packages by shipper
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel Notification Channel to send sms notification to your users in Tunisia using WinSMS. More details here https://www.winsms.tn.
You can install the package via composer:
composer require shipper/laravel-winsms-channel
You can publish configuration file using:
php artisan vendor:publish --provider="Shipper\WinSMS\WinSMSServiceProvider"
First, you need to create have an active winsms account. Go
to https://www.winsms.tn/ and create one. Once you
have access to your account, you'll need to get your API KEY. These credentials will be used to communicate with Win SMS API.
Go to https://winsmspro.com/sms/user/sms-api/info
Finally, add a new service in your config/service.php file.
// file: config/winsms.php
return [
'api_key' => env('WINSMS_API_KEY', ''),
'sender_id' => env('WINSMS_SENDER_ID', ''),
];
In your notification class, add the WinSMS Channel in the via method and create
a toWinSMS method.
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Shipper\WinSMS\WinSMSChannel;
use Shipper\WinSMS\WinSMSMessage;
class ConfirmationNotification extends Notification
{
use Queueable;
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [WinSMSChannel::class];
}
// ...others method here
/**
* Send sms using WinSMS API
*
* @param mixed $notifiable
* @return array
*/
public function toWinSMS($notifiable):WinSMSMessage
{
return (new WinSMSMessage())
->to($notifiable->phone_number)
->from('MyApp')
->content('Your account has been created successfully');
}
}
to (the receiver phone number)from (the sender phone number)content (the actual text message)You can also use the facade to send sms notification.
use Shipper\WinSMS\Facades\WinSMS;
WinSMS::sendSMS('216XXXXXXXX', 'MyApp', 'Your account has been created successfully');
The MIT License (MIT). Please see License File for more information.