Search by

itmosoft / laravel-workflows

adeelrao007

Configurable stateful business workflows, transitions, and execution history for Laravel applications.

Package info

github.com/ITMOSOFT/laravel-workflows

pkg:composer/itmosoft/laravel-workflows

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.1 2026-11-17 10:30 UTC

This package is auto-updated.

Last update: 2026-11-17 10:31:19 UTC


README

A general-purpose stateful workflow engine for Laravel applications.

Requirements

  • PHP 8.3+
  • Laravel 12 or 13

Installation

composer require itmosoft/laravel-workflows
php artisan vendor:publish --tag=itmosoft-workflows-config
php artisan migrate

Define a workflow

use ItmoSoft\Workflows\WorkflowManager;

$manager = app(WorkflowManager::class);

$definition = $manager->define('order-process', 'Order Process', [
    ['key' => 'submitted', 'name' => 'Submitted'],
    ['key' => 'review', 'name' => 'Under Review'],
    ['key' => 'completed', 'name' => 'Completed'],
]);

Start an instance

$instance = $manager->start(
    definition: $definition,
    subject: $order,
    context: ['priority' => 'high'],
);

Transition an instance

$instance = $manager->transition(
    instance: $instance,
    targetStepKey: 'review',
    actor: auth()->user(),
    context: ['note' => 'Initial checks passed'],
);

Moving an instance to the final defined step marks it completed. An active instance can also be cancelled:

$instance = $manager->cancel($instance, auth()->user(), ['reason' => 'Withdrawn']);

Statuses

  • active
  • completed
  • cancelled

Important behavior

This package records workflow definitions, ordered steps, current instance state, context, and transition history. It deliberately allows the application to choose any defined target step; it does not impose a linear-only transition graph. Your application must authorize transitions and decide which transitions are valid for each business process.

Scope limitations

No visual builder, HTTP routes, UI, queues, timers, automatic retries, conditional rule engine, notifications, parallel execution, or approval/assignee system is included. This is not a marketing automation engine.

Testing

composer install
composer test

License

MIT. See LICENSE.