Introduction to Chevere Workflow
Chevere Workflow is a PHP library for building and executing multi-step procedures with automatic dependency resolution. Define independent jobs that can run synchronously or asynchronously, pass data between them using typed responses, and let the engine handle execution order automatically.Declarative definitions
Define what to do, not how to orchestrate it. The engine handles execution order automatically.
Automatic dependency graph
Jobs execute in optimal order based on their dependencies. Parallel execution when possible.
Sync and async execution
Mix blocking and non-blocking jobs freely. The engine optimizes execution strategy.
Type-safe responses
Access job outputs with full type safety. No guessing about return types.
Conditional execution
Run jobs based on variables or previous responses. Skip unnecessary work.
Built-in retry policies
Handle transient failures automatically with configurable retry strategies.
How it works
Workflow is built around four main concepts:| Concept | Description |
|---|---|
| Job | A unit of work that produces a response |
| Variable | External input provided when running the workflow |
| Response | Reference to output from a previous job |
| Graph | Automatic execution order based on job dependencies |
Execution flow
Declare inputs
Jobs declare their inputs: literal values,
variable() references, or response() from other jobs.Build dependency graph
The engine automatically builds a dependency graph from your job definitions.
Quick example
Here’s a minimal workflow to get a taste of how it works:Core functions
Workflow provides a simple functional API:| Function | Purpose |
|---|---|
workflow() | Create a workflow from named jobs |
sync() | Create a synchronous (blocking) job |
async() | Create an asynchronous (non-blocking) job |
variable() | Declare a runtime variable |
response() | Reference another job’s output |
run() | Execute a workflow with variables |
Why Workflow?
Traditional approach
With Workflow
Each job is independently testable, the execution graph is automatically optimized, and conditional logic is declarative.
Integration with Chevere ecosystem
Workflow works seamlessly with other Chevere packages:- chevere/action - Reusable, type-safe action classes
- chevere/parameter - Parameter validation and type definitions
- chevere/container - PSR-11 dependency injection
These integrations are optional. You can use Workflow with plain closures and callables, but the Chevere ecosystem provides stronger guarantees and reduces boilerplate.
Next steps
Installation
Install Workflow via Composer and get your environment ready
Quick start
Build your first workflow in under 5 minutes