PHP code example of peec / aws-laravel-notification

1. Go to this page and download the library: Download peec/aws-laravel-notification library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

peec / aws-laravel-notification example snippets


// config/app.php
'providers' => [
    ...
    NotificationChannels\AWS\AWSSMSServiceProvider::class,
],

// config/services.php
...
'awssms' => [
    'key' => env('AWSSMS_KEY'),
    'secret' => env('AWSSMS_SECRET'),
    'region' => env('AWSSMS_REGION'),
    'from' => env('AWSSMS_FROM'), // optional
    'max_price_usd' => '0.50' // Max price, sms wont send if price of the sms is more then this.
],
...

public function routeNotificationForAws()
{
    return '+1234567890';
}
 php
use NotificationChannels\AWS\AWSSMSChannel;
use NotificationChannels\AWS\AWSSMSMessage;
use Illuminate\Notifications\Notification;

class AccountApproved extends Notification
{
    public function via($notifiable)
    {
        return [AWSSMSChannel::class];
    }

    public function toAwsSms($notifiable)
    {
        return (new AWSSMSMessage())
            ->content("Your {$notifiable->service} account was approved!");
    }
}