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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. apurba-labs/laravel-approval-engine

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

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

Batch-based approval workflow engine for Laravel

v1.5.0(1mo ago)10421MITPHPPHP ^8.4

Since Mar 19Pushed 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 3w ago

READMEChangelog (1)Dependencies (11)Versions (16)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)

### Stop Email Spam. Start Smart Approvals.

[](#stop-email-spam-start-smart-approvals)

A modular, batch-based, multi-stage approval workflow engine for Laravel. Designed for **real-world enterprise workflows** -- it handles **high-volume enterprise requests** into actionable notification batches with email-based approvals and fully configurable stages..

Demo (Real Workflow)
--------------------

[](#demo-real-workflow)

👉 Create Request → Batch → Approval → Timeline → Done

🚧 Demo GIF coming soon (actively working on UI)

Meanwhile, you can test locally:

```
php artisan approval:demo
```

---

🏗️ Active Development (UI Layer)
--------------------------------

[](#️-active-development-ui-layer)

We are currently building the frontend components to provide a full "Plug &amp; Play" experience.

ComponentStatusDescription🧾 **Workflow List**👷 In ProgressA management dashboard for all active batches.🧠 **Approval Timeline**🎨 DesigningA visual history of who approved/rejected and when.🔐 **IAM Dashboard**⚙️ Backend ReadyPowered by `laravel-iam` for scoped RBAC management.👉 **Note:** Screenshots and a full Demo GIF will be added in upcoming releases as the UI components are finalized.
------------------------------------------------------------------------------------------------------------------

[](#-note-screenshots-and-a-full-demo-gif-will-be-added-in-upcoming-releases-as-the-ui-components-are-finalized)

Why This Package? Solving "Approval Fatigue"
--------------------------------------------

[](#why-this-package-solving-approval-fatigue)

In most enterprise systems:

- **Email Spam:** 100 purchase requests = 100 separate emails to the Manager. 😓
- **Hardcoded Logic:** Approval steps are buried inside Controllers or Models.
- **No Escalation:** No built-in way to remind pending approvers or escalate.

**Laravel Approval Engine** solves this by separating the **Workflow Logic** from your **Business Models** and grouping requests into smart batches.

---

### Key Features

[](#key-features)

- **📦 Smart Batching:** Group 50 records into **1 single email/notification**.
- **⛓️ Multi-Stage Workflows:** Define paths like `Requisition -> HOS -> COO -> Finance`.
- **🔗 Secure Token-Based Approval:** Approve or Reject directly from email or Slack via expiring secure links.
- **🧩 Zero-Coupling:** Works with any Eloquent model without altering your schema.
- **⏳ Escalation Engine:** (v2.0) Automatic reminders and "Escalate to Higher Role" logic.
- **🚀 IAM Ready:** Integrates with [Laravel IAM](https://github.com/apurba-labs/laravel-iam) for scoped authority.

---

Engineering Philosophy
----------------------

[](#engineering-philosophy)

This package is built on a simple belief:

> **Workflow logic should not live inside controllers or models.**

Modern systems require:

- Separation of concerns
- Scalable architecture
- Configurable business logic

Instead of hardcoding approval flows, this engine provides:

- ✅ **Modular workflow design** (plug &amp; play modules)
- ✅ **Headless architecture** (UI-agnostic, API-first)
- ✅ **Database-driven configuration** (no redeploy needed)
- ✅ **IAM-based authorization** (not role hardcoding)

This allows teams to evolve workflows without rewriting core logic.

---

Architectural Maturity
----------------------

[](#architectural-maturity)

The PHP ecosystem is evolving beyond framework defaults toward **clean, scalable architecture**.

Recent industry trends emphasize:

- Moving from **fat controllers → Action &amp; DTO-based architecture**
- Designing **configurable, database-driven systems**
- Building **enterprise-grade workflow engines and scoring systems**
- Reducing dependency on external SaaS by building **in-house solutions**
- Improving **observability, auditability, and system transparency**

At Apurba Labs, this is not a trend — it’s the foundation.

Our systems are designed to:

- Be **modular and extensible**
- Support **complex business logic (workflows, approvals, IAM)**
- Operate in **high-scale, event-driven environments**
- Remain **framework-agnostic and future-proof**

---

How This Project Aligns
-----------------------

[](#how-this-project-aligns)

Laravel Approval Engine is built following modern architectural principles:

- ✅ Action-driven workflow execution (no fat controllers)
- ✅ IAM-based authorization (permission-first, not role-only)
- ✅ Modular workflow modules (plug &amp; play architecture)
- ✅ Database-driven workflow configuration
- ✅ Full auditability of approval lifecycle
- ✅ Batch-based processing for high-volume systems

This makes the engine suitable for **enterprise-grade applications and SaaS platforms**.

---

Example Use Cases
-----------------

[](#example-use-cases)

- 🧾 Requisition Approval (HOS → COO)
- 💰 Invoice Approval (Manager → Finance → CFO)
- 🛒 Purchase Workflow
- 🧑‍💼 Leave Approval System

---

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

[](#how-it-works)

 ```
graph TD
    A[Create Request] --> B[Batch Created]
    B --> C[Email Sent]
    C --> D[User Clicks Link]
    D --> E[Approve / Reject]
    E --> F[Next Stage]
    F --> G[Workflow Completed]
```

      Loading ---

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

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

 ```
graph TD
    A[Batch Sent] --> B[Wait]
    B --> C{Approved?}
    C -- No --> D[Reminder]
    D --> E{Still Pending?}
    E -- Yes --> F[Escalate]
```

      Loading ---

Quick Start (2 Minutes)
-----------------------

[](#quick-start-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
```

---

Setup
-----

[](#setup)

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

---

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

[](#create-workflow-module)

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

### Example: Define Module

[](#example-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',
        ];
    }
    public function relationModels(): array
    {
        return [
            'user' => \ApurbaLabs\ApprovalEngine\Tests\Support\Models\User::class,
            //'admin' => \App\Models\Admin::class,
        ];
    }
}
```

---

🔐 Token-Based Approval API
--------------------------

[](#-token-based-approval-api)

```
Approve workflows securely without login using expiring tokens.

POST /api/v1/approvals/token/approve

Example Request:

{
  "token": "secure-token-here"
}

Behavior
- Validates token (expiry + usage)
- Resolves workflow + approver
- Executes approval via engine
- Marks token as used

👉 Perfect for:

- Email approvals
- Slack / Teams integrations
- External systems
```

---

RBAC Integration (laravel-iam)
------------------------------

[](#rbac-integration-laravel-iam)

```
This engine works seamlessly with:
👉 Role-based access control (RBAC)
👉 Permission-based approval resolution

Example:

$user->can('approval.approve');
```

---

Architecture (Clean &amp; Headless)
-----------------------------------

[](#architecture-clean--headless)

 ```
graph TD
    A[Adapters: API / CLI / Queue] --> B[Workflow Manager]
    B --> C[Workflow Engine]
    C --> D[Domain Models]
    C --> E[Rule Resolver]
    C --> F[Stage Navigator]
    C --> G[Events]

    G --> H[Listeners]
    H --> I[Notifications]
    I --> J[Batch Processor]

    B --> K[Token Service]
```

      Loading ---

Commands
--------

[](#commands)

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

```

---

Why This Engine is Different
----------------------------

[](#why-this-engine-is-different)

```
Unlike traditional Laravel packages:

- ❌ No fat controllers
- ❌ No hardcoded approval flows
- ❌ No tight coupling with models

Instead:

- ✅ Headless workflow engine
- ✅ Event-driven lifecycle
- ✅ Token-based approvals
- ✅ Smart batching (enterprise-grade)
- ✅ IAM-ready (RBAC, multi-tenant future)
```

---

Roadmap
-------

[](#roadmap)

```
### v1.4 (Current 🚧)

✅ Workflow engine \
✅ IAM integration \
🔜 Filament UI \
🔜 Rule Builder (no-code)

### v2.0

🔜 Slack / Teams integration \
🔜 Advanced analytics

### v3.0 (SaaS)
🔜 Multi-tenant system \
🔜 API platform
🔜 Dashboard (Next.js)
```

---

⭐ Support the Project
---------------------

[](#-support-the-project)

```
If this package has helped you streamline your enterprise workflows, please consider supporting it:

*   **Star the Repo** – It helps other developers find this tool.
*   **Share with your Team** – Spread the word to your fellow Laravel developers.
*   **Contribute** – Submit a PR or open an issue to help make it even better.
```

---

💼 Consulting &amp; Implementation
---------------------------------

[](#-consulting--implementation)

This engine is actively used as the foundation for scalable approval systems.

If you need help designing or integrating:

- Workflow engines
- Approval pipelines
- Multi-tenant SaaS systems

Feel free to reach out.

📩 **[Connect on LinkedIn](https://www.linkedin.com/in/apurba-narayan-singh/)**
📧 ****

---

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

[](#-contributing)

PRs are welcome.

---

License
-------

[](#license)

MIT License

###  Health Score

47

—

FairBetter than 93% of packages

Maintenance91

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

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 ~6 days

Recently: every ~12 days

Total

10

Last Release

43d ago

PHP version history (2 changes)v1.0.0PHP ^8.1

v1.5.0PHP ^8.4

### Community

Maintainers

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

---

Tags

laravelworkflowrbactask automationapproval-workflowapproval-enginebatch-approvalmulti-stage-approvalenterprise-workflownotification-batchingsaas-readyprocess-approval

###  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

[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k3.5M118](/packages/bezhansalleh-filament-shield)[directorytree/ldaprecord-laravel

LDAP Authentication &amp; Management for Laravel.

5742.2M17](/packages/directorytree-ldaprecord-laravel)[casbin/laravel-authz

An authorization library that supports access control models like ACL, RBAC, ABAC in Laravel.

331361.0k4](/packages/casbin-laravel-authz)[hasinhayder/tyro

Tyro - The ultimate Authentication, Authorization, and Role &amp; Privilege Management solution for Laravel 12 &amp; 13

6753.6k5](/packages/hasinhayder-tyro)

PHPackages © 2026

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