1. Go to this page and download the library: Download cboxdk/laravel-operations 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/ */
cboxdk / laravel-operations example snippets
use Cbox\Operations\Contracts\Operations;
use Cbox\Operations\DataObjects\{StartOperation, AdvanceStep, CompleteOperation};
$operations = app(Operations::class);
$op = $operations->start(new StartOperation(
kind: 'deploy',
targetType: 'workload',
targetId: 'wl_123',
steps: ['build', 'release', 'route'],
expiresAt: now()->addMinutes(15), // stalls after this → swept to failed
));
$operations->advanceStep(new AdvanceStep($op->id, 'build')); // build done, release starts
$operations->advanceStep(new AdvanceStep($op->id, 'release'));
$operations->advanceStep(new AdvanceStep($op->id, 'route'));
$operations->complete(new CompleteOperation($op->id));