Laravel AWS SNS Events
7.x
Ask or search…
K
Links
Comment on page
📡

Configuring Events

To process the events, you need to register the package events in EventServiceProvider.php and declare your listeners that will run the code upon each one:
use Rennokki\LaravelSnsEvents\Events\SnsNotification;
use Rennokki\LaravelSnsEvents\Events\SnsSubscriptionConfirmation;
protected $listen = [
// ...
SnsNotification::class => [
SnsNotificationListener::class,
],
SnsSubscriptionConfirmation::class => [
//
],
];
class SnsNotificationListener
{
// ...
public function handle($event)
{
// $event->payload is the data passed to the event.
$content = json_decode($event->payload['message']['Message'], true);
}
}