1. Go to this page and download the library: Download descom/aws-sns-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/ */
descom / aws-sns-notification example snippets
use Descom\AwsSnsNotification\Events\TopicSubscriptionRequest;
use Illuminate\Support\Facades\Http;
class SnsSubscriptionConfirmation
{
public function handle(TopicSubscriptionRequest $event): void
{
logger()->info('SNS subscription request', [
'topic' => $event->topicArn(),
]);
// Confirm the subscription by sending a GET request to the SubscribeURL
Http::get($event->subscribeUrl());
}
}
use Descom\AwsSnsNotification\Events\TopicNotification;
use Illuminate\Support\Facades\Http;
class SnsNotificationLogger
{
public function handle(TopicNotification $event): void
{
logger()->info('SNS Notification received', [
'topic' => $event->topicArn(),
'subject' => $event->subject(),
'message' => $event->toJson(),
]);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.