helliomessaging / helliomessaging-laravel-notification-channel
Helliomessaging Notification Channel for Laravel 5.3+
Installs: 5 132
Dependents: 1
Suggesters: 1
Security: 0
Stars: 4
Watchers: 2
Forks: 2
Open Issues: 4
Requires
- php: ^8.0|^8.1|^8.2|^8.3
- guzzlehttp/guzzle: ^7.2
- illuminate/notifications: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
Requires (Dev)
- larastan/larastan: ^2.0
- laravel/pint: ^0.2|^1.13
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.5|^10.5
- dev-master
- v1.4
- v1.3
- v1.2
- v1.1
- v1.0
- dev-dependabot/github_actions/dependabot/fetch-metadata-2.1.0
- dev-dependabot/composer/phpunit/phpunit-tw-9.5tw-10.5tw-11.0
- dev-dependabot/github_actions/actions/checkout-4
- dev-dependabot/github_actions/stefanzweifel/git-auto-commit-action-5
- dev-laravel-v9-support-and-improvements
- dev-HellioMessaging-patch-1
This package is auto-updated.
Last update: 2024-10-29 23:23:06 UTC
README
This package makes it easy to send notifications using Hellio Messaging
Content
Installation
To get the latest version of Hellio Messaging Notification channel is intended for Laravel 5.5 and up, simply require the project using Composer:
composer require helliomessaging/helliomessaging-laravel-notification-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\Hellio\HellioServiceProvider::class
Setting up the Hellio Messaging Service
First, you must have an account with Hellio. Once you've registered for an account, login into your account and click on the Profile & API Integration menu on your Hellio Messaging dashboard. Click on the API Keys & Webhooks tab and copy your Client ID
and Application Secret
In your terminal run
php artisan vendor:publish --provider="NotificationChannels\Hellio\HellioServiceProvider"
This creates a hellio.php
file in your config
directory.
Paste your api keys in the config/hellio.php
configuration file. You may copy the example configuration below to get started:
<?php return [ 'config' => [ 'client_id' => env('HELLIO_CLIENT_ID'), 'app_secret' => env('HELLIO_APP_SECRET') ], ];
Or
Add the HELLIO_CLIENT_ID
and HELLIO_APP_SECRET
to your .env
file
Usage
Now you can use the channel in your via()
method in any notification you want to send using Hellio Messaging:
<?php use Illuminate\Notifications\Notification; use NotificationChannels\Hellio\HellioChannel; use NotificationChannels\Hellio\HellioMessage; class WelcomeSMS extends Notification { public function via($notifiable) { return [HellioChannel::class]; } public function toHellioSMS($notifiable) { return (new HellioMessage) ->from("HellioSMS") ->to("233242813656") //Add the country code to the number you wish to send to without the need to add the + ->content("Welcome to Hellio Messaging, a new world of litmitless possibilities.") ->messageType(0); //0 = text, 1 = flash } }
In order to let your Notification know which phone number you are sending to, add the routeNotificationForHellioSMS
method to your Notifiable model e.g your User Model
public function routeNotificationForHellioSMS() { return $this->phone; // where phone is a column in your users table; }
Available Message methods
from($from)
: set the sender's idsenderID($id)
: an alias forfrom($from)
to($to)
: set the recipient's phone numbermsisdn($msisdn)
: an alias forto($to)
messageType($messageType)
: an alias fortype($type)
content($content)
: set the message contentmessage($message)
: an alias forcontent($content)
Read more about the available methods on the Hellio Messaging Documentation Portal
Testing
composer test
Security
If you discover any security related issues, please email support@helliomessaging.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.