🕊️ កម្ពុជាត្រូវការសន្តិភាព
CAMBODIA NEEDS PEACE 🇰🇭
Laravel 12.x Compatible • Production Ready

Flexible Approval Workflow Engine for Laravel

A flexible, domain-driven approval workflow engine for Laravel applications. Designed for projects that require multi-step approval chains, such as government systems, enterprise platforms, and internal business workflows.

PHP 8.4+
Modern PHP
Laravel 12+
Framework
MIT
Open Source

Key Features

Multiple Workflow Versions

Define and evolve workflows over time without breaking existing instances with built-in versioning support

Dynamic Assignment

Assign tasks to users, roles (Spatie Permission integration), or managers with flexible resolution

Flexible Modes

Support for 'any' (one person approves) or 'all' (consensus required) approval modes per step

SLA Monitoring

Built-in support for task deadlines and breach recording with automatic tracking

Delegation

Automatic redirection of tasks based on user availability (vacation/out-of-office)

Audit Trail

Detailed event logging (started, assigned, acted, breached, completed) for every action

Conditional Transitions

Override default flow based on actions (approve/reject/changes_requested)

UI & API Agnostic

No controllers, routes, views, or APIs enforced. You decide how workflows are exposed

Team / Department Scoping

Optionally scope workflows, tasks, and approvers by team_id for multi-tenant applications

Installation

Step 1: Install Package

composer require putheakhem/approval-workflow

Step 2: Publish Config & Migrations

php artisan vendor:publish --tag=approval-workflow-config
php artisan vendor:publish --tag=approval-workflow-migrations

Step 3: Run Migrations

php artisan migrate

Step 4: Add Trait to Model

use PutheaKhem\ApprovalWorkflow\Concerns\HasWorkflow;

class ServiceRequest extends Model
{
    use HasWorkflow;
}

Quick Start

Start a Workflow

$instance = $service->startWorkflow(
    workflowKey: 'service-approval',
    context: [
        'team_id' => 1,
        'requester_id' => auth()->id(),
    ],
    teamId: 1,
    startedBy: auth()->id(),
);

🚫 What This Package Does Not Do

These concerns are intentionally handled by the consuming application:

  • Controllers or API routes
  • UI or view components
  • Notification delivery