1. Go to this page and download the library: Download amranidev/micro-bus 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/ */
// Standard SNS.
app('sns.connection')->publish('event', $data);
// Fifo SNS.
app('sns.fifo.connector')->publish('event', $data);
namespace App\Subscribers;
use Amranidev\MicroBus\Sqs\Traits\JobHandler;
class UserCreated
{
use JobHandler;
/**
* @var mixed
*/
public $payload;
/**
* @var \Illuminate\Queue\Jobs\Job
*/
public $job;
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
}
}
/**
* Execute the job.
*
* @return void
*/
public function handle(MailingList $mailingList)
{
$user = $this->payload;
// MailingList is resolved automatically from the container.
$mailingList->addUser($user->name, $user->email);
}