PHP code example of fahmiardi / laravel-notification

1. Go to this page and download the library: Download fahmiardi/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/ */

    

fahmiardi / laravel-notification example snippets


$ composer 

return [
    ...
    'sns' => [
        'key' => env('SNS_KEY'),
        'secret' => env('SNS_SECRET'),
        'region' => env('SNS_REGION'),
        'profile' => env('AWS_PROFILE'), // keep this value empty when using credentials
    ],
];



$user->notify(
    new \Fahmiardi\Laravel\Notifications\GenericSnsNotification($topicArn, $subject, $message)
);



namespace App\Notifications;

use Illuminate\Notifications\Notification;
use Fahmiardi\Laravel\Notifications\Channels\SnsChannel;
use Fahmiardi\Laravel\Notifications\Messages\SnsMessage;

class InvoicePaid extends Notification
{
    protected $invoice;

    public function __construct($invoice)
    {
        $this->invoice = $invoice;
    }

    public function via($notifiable)
    {
        return [SnsChannel::class];
    }

    public function toSns($notifiable)
    {
        return (new SnsMessage)
            ->topicArn('ARN')
            ->subject('SUBJECT')
            ->message('MESSAGE');
    }
}

$user->notify(new InvoicePaid($invoice));