Laravel AWS SNS Events
7.x
7.x
  • โšกIntroduction
  • ๐ŸŽ‰Support
  • Getting Started
    • โฌ†๏ธUpgrading from 6.x
    • ๐Ÿš€Installation
    • ๐Ÿ“กConfiguring Events
    • ๐ŸงชTesting your implementation
  • Customization
    • ๐Ÿ“ฆCustom Payload
    • ๐ŸคฟCustom Event Classes
    • ๐Ÿ”—Custom Method Hooks
  • AWS Webhooks
    • โšกIntroduction
    • ๐Ÿš€Installation
    • ๐Ÿ™ŒShowcase
    • ๐Ÿ–ฅ๏ธSupported AWS Services
      • ๐ŸšจCloudWatch Alerts
      • ๐Ÿ“งSimple Email Service (SES)
      • ๐ŸŒ‰EventBridge Events
    • ๐ŸงชTesting your implementation
Powered by GitBook
On this page

Was this helpful?

  1. Getting Started

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);
    }
}
PreviousInstallationNextTesting your implementation

Last updated 3 years ago

Was this helpful?

๐Ÿ“ก