kielabokkie / aws-pinpoint-laravel-notification-channel
Send notifications using AWS Pinpoint
Installs: 2 880
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 58
Open Issues: 2
Requires
- php: >=7.1.3
- aws/aws-sdk-php-laravel: ^3.1
- illuminate/notifications: ~5.5 || ~6.0 || ~7.0
- illuminate/support: ~5.5 || ~6.0 || ~7.0
Requires (Dev)
- mockery/mockery: ~1.0
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-07 11:17:48 UTC
README
This package makes it easy to send notifications using AwsPinpoint with Laravel 5.5+ and 6.0.
Note: Currently only SMS is supported. Other message types like voice and email are on the roadmap. Please get in touch if you would like to help out with this.
Send SMS using AWS Pinpoint the easy way.
Contents
Installation
You can install the package via composer by running the command below
composer require kielabokkie/aws-pinpoint-laravel-notification-channel
Setting up the AwsPinpoint service
This package uses the AWS Service Provider for Laravel package. You'll need to add specific configuration for AWS Pinpoint to your config/aws.php
file. See the example below:
...
'Pinpoint' => [
'region' => env('AWS_PINPOINT_REGION'),
'application_id' => env('AWS_PINPOINT_APPLICATION_ID'),
'sender_id' => env('AWS_PINPOINT_SENDER_ID'),
'key' => env('AWS_PINPOINT_KEY'),
'secret' => env('AWS_PINPOINT_SECRET'),
],
...
And then add the following entries in your .env
file:
...
AWS_PINPOINT_REGION=
AWS_PINPOINT_APPLICATION_ID=
AWS_PINPOINT_SENDER_ID=
AWS_PINPOINT_KEY=
AWS_PINPOINT_SECRET=
...
Usage
Once everything is setup you can send a notification as follows:
<?php namespace App\Notifications; use App\User; use Illuminate\Notifications\Notification; use NotificationChannels\AwsPinpoint\AwsPinpointChannel; use NotificationChannels\AwsPinpoint\AwsPinpointSmsMessage; class PhoneVerificationCreated extends Notification { /** * Get the notification's delivery channels. * * @param \App\User $notifiable * @return array */ public function via(User $notifiable) { return [AwsPinpointChannel::class]; } /** * Send SMS via AWS Pinpoint. * * @param \App\User $notifiable * @return \NotificationChannels\AwsPinpoint\AwsPinpointSmsMessage */ public function toAwsPinpoint(User $notifiable) { $message = sprintf('Your order %s has been dispatched', $this->orderId); return (new AwsPinpointSmsMessage($message)) ->setRecipients($notifiable->mobile_number); } }
Changelog
Please see CHANGELOG for more information what has changed recently.
Testing
$ composer test
Security
If you discover any security related issues, please email kielabokkie@gmail.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.