This package makes it easy to send notifications using Hubtel with Laravel 5.3+.
To get the latest version of Pushbullet Notification channel for Laravel 5.3+, simply require the project using Composer:
$ composer require norris1z/hubtel-laravel-sms-channel
If you use Laravel 5.5+ you don't need the following step.
If not, once package is installed, you need to register the service provider. Open up config/app.php
and add the following to the providers
key.
NotificationChannels\Hubtel\HubtelServiceProvider::class
In your Hubtel account go to Applications page. Click on the details of the desired application and copy your apiKey
and apiSecret
In your terminal run
$ php artisan vendor:publish --provider="NotificationChannels\Hubtel\HubtelServiceProvider"
This creates a hubtel.php
file in your config
directory.
Paste your apiCredentials in the config/hubtel.php
configuration file. You may copy the example configuration below to get started:
'account' => [
'key' => env('HUBTEL_API_KEY'),
'secret' => env('HUBTEL_API_SECRET')
]
Or
Add the HUBTEL_API_KEY
and HUBTEL_API_SECRET
to your .env
file
Now you can use the channel in your via()
method inside the notification:
use Illuminate\Notifications\Notification;
use NotificationChannels\Hubtel\HubtelChannel;
use NotificationChannels\Hubtel\HubtelMessage;
class SayHello extends Notification
{
public function via($notifiable)
{
return [HubtelChannel::class];
}
public function toSMS($notifiable)
{
return (new HubtelMessage)
->from("JabClari")
->to("2331234567890")
->content("Kim Kippo... Sup with you");
}
}
In order to let your Notification know which phone number you are sending to, add the routeNotificationForSMS
method to your Notifiable model e.g your User Model
public function routeNotificationForSMS()
{
return $this->phone; // where phone is a cloumn in your users table;
}
from($from)
: set the sender's name or phone numberto($to)
: set the recipient's phone numbercontent($content)
: set the message contentregisteredDelivery()
: set delivery report requestclientReference($reference)
: set the client reference numbertype($type)
: set the message type to be sentudh($udh)
: set the User Data Header of the SMS Message being senttime($time)
: set the time to deliver the messageflashMessage()
: sends the message as a flash message
Read more about the avialable methods on the Hubtel Documentation Page
Please see CHANGELOG for more information what has changed recently.
$ composer test
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Please see CONTRIBUTING for details.
The MIT License (MIT). Please see License File for more information.