PHP code example of vaened / php-delta-orchestrator
1. Go to this page and download the library: Download vaened/php-delta-orchestrator 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/ */
vaened / php-delta-orchestrator example snippets
// Patch + current state
$startDate = Field::from(
// incoming patch vs current value
patch : $payload->startDate,
current: $availability->startDate,
);
$endDate = Field::from(
patch : $payload->endDate,
current: $availability->endDate,
);
$orchestrator = new Orchestrator();
$orchestrator->register(
// this action runs only if it applies, its contract is satisfied,
// and there is an effective delta
Action::for([$startDate, $endDate])
->apply(function (Field $startDate, Field $endDate): void {
// use $field->delta(), $field->value(), $field->current()
}),
);
$result = $orchestrator->execute();
final readonly class UpdateAvailabilityCommand
{
public function __construct(
public DateTimeImmutablePatchValue $startDate,
public DateTimeImmutablePatchValue $endDate,
) {}
}
use function Vaened\DeltaOrchestrator\Rules\all;
use function Vaened\DeltaOrchestrator\Rules\any;
all([$startDate, $endDate]);
any([$startDate, $endDate]);
new IntPatchValue(true, '20')->value();
new BoolPatchValue(true, 'true')->value();
new DateTimeImmutablePatchValue(true, '2026-04-26 10:20:30')->value();
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.