sykez / genusis-sms
Genusis Gensuite v10 API SMS Channel for Laravel.
Requires
- php: ^7.0
- illuminate/log: ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/notifications: ^5.5 || ^6.0 || ^7.0 || ^8.0
- illuminate/support: ^5.5 || ^6.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2025-03-13 16:08:20 UTC
README
This package makes it easy to send notifications using Genusis SMS Gateway via Gensuite API with Laravel.
Contents
Installation
Install package via Composer:
composer require sykez/genusis-sms
Setting up the Genusis SMS service
Add the service configration into your config/services.php
:
'genusis-sms' => [ 'client_id' => env('GENUSIS_SMS_CLIENT_ID', null), 'username' => env('GENUSIS_SMS_USERNAME', null), 'private_key' => env('GENUSIS_SMS_PRIVATE_KEY', null), 'url' => env('GENUSIS_SMS_URL', null), 'debug_log' => env('GENUSIS_SMS_DEBUG_LOG', false), ],
Add the environment variablesinto your .env
and set your Client ID, Username, Private Key and API URL.
GENUSIS_SMS_CLIENT_ID=
GENUSIS_SMS_USERNAME=
GENUSIS_SMS_PRIVATE_KEY=
GENUSIS_SMS_URL=
Usage
Now you can send SMS from your notification:
Sending Notification
use Sykez\GenusisSms\GenusisSmsChannel; use Sykez\GenusisSms\GenusisSmsMessage; use Illuminate\Notifications\Notification; class SendSms extends Notification { public function via($notifiable) { return [GenusisSmsChannel::class]; } public function toSms($notifiable) { return (new GenusisSmsMessage)->content("Hello there!"); } }
Routing Notification
You can route the notification to a phone number with to()
:
public function toSms($notifiable) { return (new GenusisSmsMessage)->content("Hello there!")->to(01234567891); }
Or you can add routeNotificationForSms()
method in your notifiable model:
public function routeNotificationForSms() { return $this->phone_number; }
You can also do on-demand notifications:
use Illuminate\Support\Facades\Notification; Notification::route('sms', '01234567891')->notify(new App\Notifications\SendSms(['Hello again.']));
Logs & Debug
You can set your GENUSIS_SMS_DEBUG_LOG=true
in your .env
to send all requests and responses to into your Laravel logs.
License
The MIT License (MIT). Please see License File for more information.