2017 © Pedro Peláez
 

library laravel-notification

Various laravel notifications channels

image

fahmiardi/laravel-notification

Various laravel notifications channels

  • Thursday, December 15, 2016
  • by fahmiardi
  • Repository
  • 1 Watchers
  • 0 Stars
  • 213 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

More Laravel Notification Providers

Available Channels:

  • AWS SNS (Simple Notification Services), support using credentials or profile

Install

$ composer require fahmiardi/laravel-notification

Setup

Add config to app/services.php:, (*1)

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
    ],
];

Usage

Use generic:, (*2)

<?php

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

Create your own:, (*3)

Read the official page https://laravel.com/docs/5.3/notifications#creating-notifications, (*4)

<?php

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));

The Versions

15/12 2016

dev-master

9999999-dev https://github.com/fahmiardi/laravel-notification

Various laravel notifications channels

  Sources   Download

MIT

The Requires

 

laravel sns notification

15/12 2016