Skip to main content

Installation

Chevere Workflow is available through Packagist and requires PHP 8.1 or higher.

Requirements

Before installing Workflow, ensure your environment meets these requirements:
  • PHP 8.1 or higher
  • Composer for dependency management

Install via Composer

Install Workflow using Composer:
composer require chevere/workflow
This will install Workflow along with its required dependencies:
  • amphp/amp - Asynchronous concurrency framework
  • chevere/action - Type-safe action classes
  • chevere/caller - Callable invocation utilities
  • chevere/container - PSR-11 dependency injection container
  • chevere/data-structure - Data structure utilities
  • chevere/parameter - Parameter validation and type definitions
  • chevere/regex - Regular expression utilities
All dependencies are automatically installed by Composer. You don’t need to install them separately.

Verify installation

Create a simple test file to verify the installation:
test.php
<?php

require 'vendor/autoload.php';

use function Chevere\Workflow\{workflow, sync, variable, run};

$workflow = workflow(
    greet: sync(
        fn(string $name): string => "Hello, {$name}!",
        name: variable('username')
    )
);

$result = run($workflow, username: 'World');
echo $result->response('greet')->string() . PHP_EOL;
Run the test:
php test.php
You should see:
Hello, World!
If you see the greeting message, Workflow is installed correctly!

Optional dependencies

While Workflow works standalone, you may want to install additional Chevere packages for enhanced development experience:

Development tools

composer require --dev chevere/var-dump
The chevere/var-dump package provides enhanced debugging output for workflow objects.

Testing tools

For testing workflows, install PHPUnit:
composer require --dev phpunit/phpunit

IDE support

PHPStan integration

Workflow is built with PHPStan level 9 compliance. Install PHPStan for static analysis:
composer require --dev phpstan/phpstan
Create a phpstan.neon configuration:
phpstan.neon
parameters:
    level: 9
    paths:
        - src
Run analysis:
vendor/bin/phpstan analyze

IDE autocomplete

Workflow uses named arguments extensively. Ensure your IDE supports PHP 8.1+ features:
  • PhpStorm - Full support out of the box
  • VS Code - Install the PHP Intelephense extension
  • Sublime Text - Install LSP and LSP-intelephense packages

Configuration

Workflow requires no configuration files. All setup is done through code using the functional API.

Autoloading

Workflow automatically registers its functions through Composer’s autoloader. The following functions are available globally after requiring the autoloader:
  • workflow()
  • sync()
  • async()
  • variable()
  • response()
  • run()
These functions are namespaced under Chevere\Workflow. Import them with use function statements or call them with the full namespace.

Directory structure

Here’s a recommended project structure for Workflow projects:
project/
├── src/
│   ├── Actions/          # Reusable Action classes
│   │   ├── FetchData.php
│   │   ├── ProcessData.php
│   │   └── StoreData.php
│   └── Workflows/        # Workflow definitions
│       └── DataPipeline.php
├── tests/
│   ├── Actions/          # Action unit tests
│   └── Workflows/        # Workflow integration tests
├── vendor/
├── composer.json
└── phpunit.xml

Troubleshooting

Memory limit errors

If you encounter memory limit errors with large workflows, increase PHP’s memory limit:
php -d memory_limit=512M your-script.php
Or in your php.ini:
memory_limit = 512M

Missing function errors

If you see errors about undefined functions, ensure you’re importing them correctly:
// Correct
use function Chevere\Workflow\{workflow, sync, run};

// Incorrect - will cause "Call to undefined function" errors
use Chevere\Workflow\workflow;

Amphp conflicts

If you have other packages that depend on Amphp v2, you may encounter conflicts. Workflow requires Amphp v3.1+. Update conflicting packages or use Composer’s --with-all-dependencies flag:
composer update --with-all-dependencies

Next steps

Quick start

Build your first workflow and learn the core concepts

Build docs developers (and LLMs) love