zanozik/semysms
SemySMS Notifications Channel
Installation
You can install the package via composer:
composer require zanozik/semysms
You must install the service provider:
// config/app.php
'providers' => [
...
NotificationChannels\SemySMS\SemySMSServiceProvider::class,
],
Setting up the SemySMS service
Sign up on SemySMS and create your token in your Control Panel -> API.
Add the following section and fill in the details there (you can also use your .env file to store your credentials):
// config/services.php
...
'semysms' => [
'token' => env('SEMYSMS_TOKEN', '12345678901234567890'),
'device' => env('SEMYSMS_DEVICE', '12345')
],
...
Usage
You can now use the channel in your via() method inside the Notification class.
use NotificationChannels\SemySMS\SemySMSChannel;
use NotificationChannels\SemySMS\SemySMSMessage;
use Illuminate\Notifications\Notification;
class InvoicePaid extends Notification{
public function via($notifiable){
return [SemySMSChannel::class];
}
public function toSmsGatewayMe($notifiable){
return (new SemySMSMessage)->text('Your invoice has been paid');
}
}
Routing a message
You should add a routeNotificationForSemySMS() method in your notifiable model:
...
/**
* Route notifications for the SemySMS channel.
*
* @return int
*/
public function routeNotificationForSemySMS(){
return $this->phone_number;
}
...
Available methods
text($text): (string) SMS Text.
License
The MIT License (MIT). Please see License File for more information.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
641,106,524
9,700
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
418,291,778
609
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
399,241,428
4,660
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.1 | >=5.6.4 | ^5.1| | MIT |