onethirtyone/aws-sns-handler

Laravel package to handle incoming SNS messages

1.1 2020-04-02 15:19 UTC

This package is auto-updated.

Last update: 2024-04-29 04:21:11 UTC


README

Build Status StyleCI

This is a Laravel package for validating and handling AWS SNS messages

Installation

You can install the package with composer

composer require onethirtyone/aws-sns-handler

CSRF

Since SNS messages are sent via a HTTP Post Request you will need to add your webhook route to your VerifyCsrfToken.php

/**
     * The URIs that should be excluded from CSRF verification.
     *
     * @var array
     */
    protected $except = [
        '/webhook'
    ];

Usage

Edit your routes/web.php and add a route to your the webhook handler

Route::any('callback', 'OneThirtyOne\Sns\Controllers\SnsController@handle');

Events

The package will fire an SnsSubscriptionConfirmation event when a new subscription is added and needs to be confirmed and will fire an SnsEvent event when a message is delivered after confirmation.

You should listen for these events in your application.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change

License

MIT