PHPackages                             apurba-labs/laravel-approval-engine - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. apurba-labs/laravel-approval-engine

ActiveLibrary

apurba-labs/laravel-approval-engine
===================================

Batch-based approval workflow engine for Laravel

v1.2.0(1mo ago)21↓100%MITPHPPHP ^8.1

Since Mar 18Pushed 1mo agoCompare

[ Source](https://github.com/apurba-labs/laravel-approval-engine)[ Packagist](https://packagist.org/packages/apurba-labs/laravel-approval-engine)[ RSS](/packages/apurba-labs-laravel-approval-engine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (9)Used By (0)

Laravel Approval Engine
=======================

[](#laravel-approval-engine)

[![Laravel](https://camo.githubusercontent.com/afe280ed5336d32590bb167f1a6223e8fa18cee7201d77bd523675721ac433a3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302e782d7265643f6c6f676f3d6c61726176656c)](https://laravel.com/)[![PHP](https://camo.githubusercontent.com/b3dc90cb0374438e8ee57e57679045efe8f43f96aaad5e09d74b802a9c05f72d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322d626c75653f6c6f676f3d706870)](https://www.php.net/)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE)[![GitHub stars](https://camo.githubusercontent.com/d630b8cb3a34b69782a44f6f1cfb63411ed1e4db9c4f6f15921579f703cda8df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6170757262612d6c6162732f6c61726176656c2d617070726f76616c2d656e67696e653f7374796c653d736f6369616c)](https://github.com/apurba-labs/laravel-approval-engine/stargazers)

A modular, batch-based, multi-stage approval workflow engine for Laravel. Designed for **real-world enterprise workflows** -- Supports batch approvals, email-based approval links, and configurable workflow stages.

---

🔥 Why This Package Exists
-------------------------

[](#-why-this-package-exists)

In most Laravel projects:

- Approval workflows are rebuilt again and again
- Logic gets tightly coupled with business models
- Email spam happens (1 record = 1 email 😓)

👉 This package solves that with a clean, scalable architecture

---

Key Features
------------

[](#key-features)

- **Multi-stage** approval workflows
- **Batch processing** (20 approvals → 1 email)
- **Email-based** approval links
- **Modular** workflow system (plug &amp; play)
- **Event-driven** architecture
- **No hard dependency** on roles system
- **Clean architecture** (Engine + Actions + Support)

---

🧠 Example Workflows
-------------------

[](#-example-workflows)

- Requisition → HOS → COO → Completed
- Invoice → Manager → Finance → CFO
- Purchase → Supervisor → Director

---

🏗 How It Works
--------------

[](#-how-it-works)

 ```
graph TD
    A[Approved Records] --> B[Batch Created]
    B --> C[Email Sent]
    C --> D[User Clicks Approval Link]
    D --> E[Next Stage Triggered]
    E --> F[Workflow Completed]

    style A fill:#f9f9f9,stroke:#333
    style F fill:#d4edda,stroke:#28a745,stroke-width:2px
```

      Loading ---

📊 Workflow Flow
---------------

[](#-workflow-flow)

 ```
graph TD
    A[Approved Records] --> B[Batch Created]
    B --> C[Email Sent]
    C --> D[User Clicks Approval Link]
    D --> E[Stage Resolver]
    E --> F{Next Stage?}
    F -- Yes --> G[Create Next Batch]
    G --> H[Send Next Approval]
    F -- No --> I[Workflow Completed]

    style F fill:#f9f,stroke:#333,stroke-width:2px
    style I fill:#dfd,stroke:#333,stroke-width:2px

```

      Loading ---

⏱ Escalation &amp; Reminder Flow
--------------------------------

[](#-escalation--reminder-flow)

 ```
%%{init: { 'theme': 'base', 'themeVariables': { 'nodeTextColor': '#000000' }}}%%
graph TD
    A[Batch Sent] --> B[Wait 24 Hours]
    B --> C{Approved?}
    C -- No --> D[Send Reminder]
    D --> E[Wait Again]
    E --> F{Still Pending?}
    F -- Yes --> G[Escalate to Higher Role]

    style C fill:#fff4dd,stroke:#d4a017
    style F fill:#fff4dd,stroke:#d4a017
    style G fill:#f8d7da,stroke:#721c24,stroke-width:2px
```

      Loading ---

🚀 Quick Demo (2 Minutes)
------------------------

[](#-quick-demo-2-minutes)

```
git clone https://github.com/apurba-labs/laravel-approval-engine

cd laravel-approval-engine/example/laravel-demo

composer install
cp .env.example .env
php artisan key:generate

php artisan migrate
php artisan approval:demo
```

👉 Output:

```
✔ Sample data created
✔ Batch generated
✔ Approval link generated
```

📸 Demo Screenshot
-----------------

[](#-demo-screenshot)

[![Workflow](./docs/demo.png)](./docs/demo.png)
-----------------------------------------------

[](#)

⚙️ Installation
---------------

[](#️-installation)

```
composer require apurba-labs/laravel-approval-engine
```

---

🔧 Publish Config, Migrations &amp; Seeders
------------------------------------------

[](#-publish-config-migrations--seeders)

```
php artisan vendor:publish --tag=approval-config
php artisan migrate
php artisan db:seed --class="ApurbaLabs\ApprovalEngine\Database\Seeders\WorkflowSeeder"
php artisan db:seed --class="ApurbaLabs\ApprovalEngine\Database\Seeders\WorkflowSettingSeeder"
```

---

🧩 Create Workflow Module
------------------------

[](#-create-workflow-module)

```
php artisan make:workflow-module Requisition
```

### 🧠 Define Module

[](#-define-module)

```
class RequisitionModule extends BaseWorkflowModule
{
    public function model(): string
    {
        return \App\Models\Requisition::class;
    }

    /**
     * Validate records before they enter a batch.
     * Useful for checking data integrity or custom business rules.
     */
    public function validate(array $data): void
    {
        // Default: No validation required
        validator($data, [
            'total_amount' => 'required|numeric|min:1',
            'user_id' => 'required|exists:users,id',
        ])->validate();
    }

    public function approvedColumn(): string
    {
        return 'approved_at';
    }

    /**
     * Default status column name.
     * Override this in the child class if it differs.
     */
    public function statusColumn(): string
    {
        return 'status';
    }

    /**
     * Default priorities: check for 'user', then 'creator'.
     * Individual modules can override this.
     */
    public function ownerRelations(): array
    {
        return ['user', 'creator'];
    }

    /**
     * Allow developers to add extra relations (like 'items' or 'department').
     */
    protected function customRelations(): array
    {
        return [];
    }

    public function selectColumns(): array
    {
         return [
            'id',
            'user_id',
            'reference_id',
            'stage',
            'stage_status',
            'status',
            'approved_at',
        ];
    }

    public function displayColumns(): array
    {
        return [
            'reference_id' => 'Reference',
            'user.name' => 'Requested By',
        ];
    }
}
```

---

Running Batch Processor
-----------------------

[](#running-batch-processor)

Run the batch processor via cron:

```
php artisan approval:send-batch

```

Example cron job:

```
* * * * * php artisan approval:send-batch

```

---

Approval Links
--------------

[](#approval-links)

Emails contain secure token-based approval links:

```
/approval/batch/{token}

```

Approvers can:

- Approve All
- Reject
- View Details

---

🧠 Architecture
--------------

[](#-architecture)

### System Layering Overview

[](#system-layering-overview)

 ```
%%{init: { 'theme': 'base', 'themeVariables': { 'primaryColor': '#e1f5fe', 'nodeTextColor': '#000000', 'mainBkg': '#e1f5fe', 'lineColor': '#333' }}}%%
graph TD
    A[Artisan Command] --> B[WorkflowEngine]
    B --> C[Actions Layer]

    subgraph Core
    C --> D[BatchProcessor]
    D --> E[StageResolver]
    end

    E --> F[Events]
    F --> G[Notifications]

    %% Styles
    classDef blackText color:#000000,stroke:#333,stroke-width:1px;
    class A,B,C,D,E,F,G blackText;

    style B fill:#e1f5fe
    style D fill:#fff3e0
    style E fill:#f3e5f5
    style G fill:#e8f5e9
```

      Loading This will generate a module structure ready for workflow integration.

---

Check Pending Batches
---------------------

[](#check-pending-batches)

```
php artisan approval:status

```

Example Output:

✔ Batch processing
✔ Email notifications
✔ Modular workflows

---

🚀 Roadmap
---------

[](#-roadmap)

### v1.0

[](#v10)

✔ Batch processing
✔ Email approvals
✔ Modular workflows

### v2.0

[](#v20)

🔜 Reminder engine
🔜 Slack / Teams integration
🔜 Escalation rules

### v3.0

[](#v30)

🔜 Workflow UI builder
🔜 API support
🔜 Multi-tenant SaaS

This project demonstrates:

- **Requisition Approval Workflow**: A real-world implementation of the engine.
- **Batch Processing**: See how 10+ records are grouped into a single approval task.
- **Approval Links**: Test the token-based GET requests in a live Laravel 12 environment.

To run the demo:

1. Navigate to `example/laravel-demo`
2. Run `composer install`
3. Run `php artisan approval:demo` to generate test data and an approval link.

---

🤝 Contributing
--------------

[](#-contributing)

PRs are welcome.

---

⭐ Support
---------

[](#-support)

If this project helps you:

- 👉 Give it a star ⭐
- 👉 Share with your team

---

License
-------

[](#license)

MIT License

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance90

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

3

Last Release

53d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cf451535411e28149e4b7f65d90625f54be2dc4f9a37bd119eee6204d3f73566?d=identicon)[apurbasingh](/maintainers/apurbasingh)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apurba-labs-laravel-approval-engine/health.svg)

```
[![Health](https://phpackages.com/badges/apurba-labs-laravel-approval-engine/health.svg)](https://phpackages.com/packages/apurba-labs-laravel-approval-engine)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
