laraketai / mobizon
Mobizon SMS notifications driver for Laravel
Requires
- php: ^7.3|^8.0
README
This package makes it easy to send SMS notifications using Mobizon with Laravel 5.3.
Contents
Installation
You can install this package via composer:
composer require laraketai/mobizon
Laravel 5.5 < Add the service provider to config/app.php
:
// config/app.php 'providers' => [ ... Laraketai\Mobizon\MobizonServiceProvider::class, ],
Publish Config File config/mobizon.php
:
php artisan vendor:publish --provider="Laraketai\Mobizon\MobizonServiceProvider"
Setting up your Mobizon service
Log in to your Mobizon and grab your Api, Api Secret Key. Add them to config/services.php
.
// config/mobizon.php ... 'mobizon' => [ 'alphaname' => null, //Optional, if you don't have registered alphaname, just skip this param and your message will be sent with our free common alphaname. 'secret' => env('MOBIZON_APP_KEY'), // Your secret API key ],
Usage
Follow Laravel's documentation to add the channel your Notification class:
use Illuminate\Notifications\Notification; use Laraketai\Mobizon\MobizonChannel; use Laraketai\Mobizon\MobizonMessage; public function via($notifiable) { return [MobizonChannel::class]; } public function toMobizon($notifiable) { return MobizonMessage::create("Task #{$notifiable->id} is complete!"); }
Add a routeNotificationForMobizon
method to your Notifiable model to return the phone number:
public function routeNotificationForMobizon() { //Phone Number without symbols or spaces return $this->phone_number; }
Available methods
content()
- (string), SMS notification body
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email sanzhar@aketai.com instead of using the issue tracker.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.