This package makes it easy to send notifications using Unifonic Api with Laravel 5.5+, 6.x, 7.x and 8.x
- Before start you have to create an account on Unifonic.
- You can install the package via composer:
composer require laravel-notification-channels/unifonic
Add your Unifonic AppsId to your config/services.php
:
// config/services.php
...
'unifonic' => [
'appsId' => env('UNIFONIC_APPS_ID'),
],
...
Now you can use the channel in your via()
method inside the notification:
use NotificationChannels\Unifonic\UnifonicChannel;
use NotificationChannels\Unifonic\UnifonicMessage;
use Illuminate\Notifications\Notification;
class InvoicePaid extends Notification
{
public function via($notifiable)
{
return [UnifonicChannel::class];
}
public function toUnifonic($notifiable)
{
return UnifonicMessage::create("Your invoice {$notifiable->order->id} was paid!");
}
}
In order to let your Notification know which phone numer you are targeting, add the routeNotificationForUnifonic
method to your Notifiable model.
Important note: Unifonic requires the recipients phone number to be E.164
// app/Models/User.php
public function routeNotificationForUnifonic()
{
return '+21267064497';
}
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email imad@devinweb.com instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.