1. Go to this page and download the library: Download samaphp/laravel-bounded 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/ */
use Samaphp\LaravelBounded\Transaction\Transaction;
final class CreateOrder
{
public function __construct(private readonly Transaction $transaction) {}
public function execute(CreateOrderInput $input): Order
{
return $this->transaction->run(function () use ($input) {
// persist + dispatch jobs explicitly
return Order::create([...]);
});
}
}