1. Go to this page and download the library: Download radynsade/idemflow-core 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/ */
radynsade / idemflow-core example snippets
use DateInterval;
use IdemFlow\Core\Executor;
use IdemFlow\Core\Operation;
use IdemFlow\Core\PayloadFingerprint;
use IdemFlow\Core\Store\InMemoryOperationStore;
$store = new InMemoryOperationStore();
$executor = new Executor(
store: $store,
transactionBoundary: $store,
);
$operation = Operation::atomic(
scope: 'orders.create',
key: 'request-123',
fingerprint: PayloadFingerprint::fromArray([
'customerId' => 10,
'items' => [['sku' => 'book', 'quantity' => 2]],
]),
retention: new DateInterval('P7D'),
);
$result = $executor->execute(
$operation,
fn (): array => ['orderId' => 42],
);
$result->value(); // ['orderId' => 42]
$result->wasExecuted(); // true on the first call
$result->wasReplayed(); // true on later calls
$result->attempt(); // fencing attempt stored with the operation
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.