The Daily Commit · Section Edition Front Page PHP AI Dev EN DE FR ES

The Php Times

Reads — Ecosystem

Saga Lara Flow Brings Durable Workflows and Saga Rollbacks to Laravel Queues

LARAVEL NEWS, August 7, 2026 curated by Sönke

Saga Lara Flow is a Laravel package that turns long-running business processes into plain PHP methods on top of queues, with recorded steps, replay semantics, compensating transactions, signals, parallel blocks, and child workflows.

Saga Lara Flow, a Laravel package by Andriy Karpishyn (discovery-ukraine), lets developers express long-running business processes as a single handle() method instead of chaining jobs or building state machines. Charging a card, reserving stock, and booking a shipment can be written as sequential lines of code. The package records every completed step to the database. When a run resumes on a worker, the engine re-executes handle(), but calls through $this->action() return previously recorded results for finished steps; once replay reaches unexecuted code, normal execution continues. If a step throws, compensation logic for earlier steps fires in reverse order.

Core features include compensations via compensateWith() (either an action class or a closure), signals via $this->signal() with optional timeoutAfter() deadlines and an AwaitSignalTimeoutException, parallel blocks with a default failFast() policy, child workflows with a ChildClosePolicy (e.g. Terminate), and sideEffect() for recording non-deterministic values like UUIDs so replays stay consistent. Tag-based querying (withTags(), $this->tag()) plus scopes such as running(), waiting(), and failed() allow locating and acting on runs without storing IDs, e.g. delivering a signal to all matching runs.

Workflows extend the package's Workflow class; actions are separate container-resolved classes with their own queue settings: $tries, $timeout, and expiresAt(). Exhausted retries surface as ActionFailedException; a passed deadline as FlowExpiredException. Optional steps use continueOnFailure()/optionalAction() with fallback values. The $this->saga() builder groups steps into one rollback unit with onCompensationFailure(CompensationFailurePolicy::Continue) and compensateInParallel() options. Runs start via the SagaFlow facade: run() queues asynchronously, runSync() executes in-process for easy test assertions. Version pinning (version('v2')) keeps in-flight runs on their original workflow definition.

The package requires PHP 8.5 and Laravel 13, is MIT-licensed, and installs via composer require discovery-ukraine/saga-lara-flow followed by migrations and config publishing. The config covers database connection, queue, locking, and multi-tenancy hooks (capture/restore closures for tenant context). Artisan commands include make:workflow, make:action, saga-flow:list, saga-flow:signal, saga-flow:prune, and saga-flow:monitor, which should be scheduled every minute to enforce deadlines. Documentation lives at sagalaraflow.dev; the source is on GitHub at discovery-ukraine/saga-lara-flow.

Read the original source ↗

Rate this article: 0

Readers’ Forum

No contributions yet — open the debate.

← Ecosystem — Page B1

"All the Code That's Fit to Ship" · The Daily Commit · Screen edition · Imprint · Privacy Policy