1. Go to this page and download the library: Download mohamedhekal/event-outbox 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/ */
mohamedhekal / event-outbox example snippets
use Hekal\EventOutbox\Facades\Outbox;
use Illuminate\Support\Facades\DB;
DB::transaction(function () use ($order) {
$order->save();
Outbox::record('order.created', [
'id' => $order->id,
'total' => $order->total,
]);
});
// routes/console.php or Kernel
Schedule::command('outbox:publish')->everyMinute();
use Hekal\EventOutbox\Support\IdempotentConsumer;
app(IdempotentConsumer::class)->once($message->uuid, function () {
// side effects
}, consumer: 'billing');