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

1. Go to this page and download the library: Download ervinomueller/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/ */

    

ervinomueller / 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', 'your-public-key'),
    'secret' => env('AWS_SECRET_ACCESS_KEY', 'your-secret-key'),
    'queue'  => env('QUEUE_URL', '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
    ],
    //optional - you can override default job when no job are found on routes array above
    'default-job' => 'App\\Jobs\\YourDefaultJob',
  ],
],

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)
  {
  }
}