boring-dragon / msgowl-laravel-notification-channel
MsgOwl notification channel for laravel
v1.0.4
2023-05-27 13:14 UTC
Requires
- php: ^8.0|^8.1
- ext-json: *
- guzzlehttp/guzzle: ^7.0.1|^7.2
- illuminate/notifications: ^8.0|^9.0|^10.0
- illuminate/queue: ^8.0|^9.0|^10.0
- illuminate/support: ^8.0|^9.0|^10.0
Requires (Dev)
- laravel/pint: ^1.10
- mockery/mockery: ^1.4.4
- phpunit/phpunit: ^9.5.10|^10.0
README
Installation
You can install the package via composer:
composer require boring-dragon/msgowl-laravel-notification-channel
Setting up your MsgOwl Credentials
Add the environment variables to your config/services.php
:
// config/services.php ... 'msgowl' => [ 'sender_id' => env('MSGOWL_SENDER_ID'), 'api_key' => env('MSGOWL_API_KEY'), 'recipients' => env('MSGOWL_RECIPIENTS'), ], ...
Add your MsgOwl API Key, Default SenderID and default recipients to your .env
:
// .env ... MSGOWL_SENDER_ID= MSGOWL_API_KEY= MSGOWL_RECIPIENTS= ], ...
Usage
Now you can use the channel in your via()
method inside the notification:
use BoringDragon\MsgowlLaravelNotificationChannel\MsgOwlChannel; use BoringDragon\MsgowlLaravelNotificationChannel\MsgOwlMessage; use Illuminate\Notifications\Notification; class UserApproved extends Notification { public function via($notifiable) { return [MsgOwlChannel::class]; } public function toMsgOwl($notifiable) { return (new MsgOwlMessage("You are approved by the system")); } }
you can add recipients (single value or array)
return (new MsgOwlMessage("You are approved by the system"))->setRecipients($recipients);
Or You can add a routeNotificationForMsgOwl
method to your Notifiable model to return the phone number(s):
public function routeNotificationForMsgOwl() : string { return $this->mobile; }
Reference
Security
If you discover any security related issues, please email boringdragon98@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
Disclaimer
This package is not in any way officially affiliated with MsgOwl.