PHP code example of joblocal / laravel-sqs-sns-subscription-queue

1. Go to this page and download the library: Download joblocal/laravel-sqs-sns-subscription-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/ */

    

joblocal / laravel-sqs-sns-subscription-queue example snippets


'providers' => [
    // ...
    Joblocal\LaravelSqsSnsSubscriptionQueue\SqsSnsServiceProvider::class,
],

$app->register(Joblocal\LaravelSqsSnsSubscriptionQueue\SqsSnsServiceProvider::class);

'connections' => [
  'sqs-sns' => [
    'driver' => 'sqs-sns',
    'key'    => env('AWS_ACCESS_KEY_ID'),
    'secret' => env('AWS_SECRET_ACCESS_KEY'),
    'queue'  => env('SQS_QUEUE', 'your-queue-url'),
    'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
    'routes' => [
        // you can use the "Subject" field
        'Subject' => 'App\\Jobs\\YourJob',
        // or the "TopicArn" of your SQS message
        'TopicArn:123' => 'App\\Jobs\\YourJob',
        // to specify which job class should handle the job
    ],
  ],
],

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

/**
 * Example Job class
 */
class Job implements ShouldQueue
{
  use InteractsWithQueue, Queueable, SerializesModels;

  /**
   * @param string  $subject   SNS Subject
   * @param array   $payload   JSON decoded 'Message'
   */
  public function __construct(string $subject, array $payload)
  {
  }
}