PHP code example of maxgaurav / laravel-sns-sqs-queue
1. Go to this page and download the library: Download maxgaurav/laravel-sns-sqs-queue 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/ */
maxgaurav / laravel-sns-sqs-queue example snippets
return [
//...
'sqs' => [
'driver' => 'sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'sns-sqs' => [
'driver' => 'sns-sqs',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'),
'queue' => env('SQS_QUEUE', 'your-queue-name'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
'sns-config' => [
'topics' => [
'topicName' => \App\Jobs\YourJob::class,
'topic2Name' => \App\Jobs\YourOtherJob::class
//...
],
'default-job' => '', // if you want to override the default job executed for non matching topics
'prefix' => env('SNS_PREFIX', 'arn:aws:sns:us-east-2:123345666:'), // SNS Topic Prefix (must
class SampleJob {
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* @var string
*/
public $topic;
/**
* @var array
*/
public $body;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($topic, $body)
{
$this->topic = $topic;
$this->body = $body;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
// do your handling
}
}