PHPackages                             mr-rijal/laravel-pipeline - 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. mr-rijal/laravel-pipeline

ActiveLibrary

mr-rijal/laravel-pipeline
=========================

Lightweight workflow and automation pipeline for Laravel

1.0.3(3mo ago)218MITPHPPHP ^8.2CI passing

Since Jan 23Pushed 3mo agoCompare

[ Source](https://github.com/mr-rijal/laravel-pipeline)[ Packagist](https://packagist.org/packages/mr-rijal/laravel-pipeline)[ RSS](/packages/mr-rijal-laravel-pipeline/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (6)Versions (5)Used By (0)

Laravel Pipeline
================

[](#laravel-pipeline)

[![Workflow](https://camo.githubusercontent.com/21af7e5baacc8a7a36e221600bd8c5b80a45392b316842c786dd9a8644430ec2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d722d72696a616c2f6c61726176656c2d706970656c696e652f2e676974687562253246776f726b666c6f777325324663692e796d6c)](https://github.com/mr-rijal/laravel-pipeline/actions)[![Latest Version](https://camo.githubusercontent.com/a52e49d07ca661305364c485c79e239bfbe0a5ac3ba595fe840c97f3ae18c4b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d722d72696a616c2f6c61726176656c2d706970656c696e652e737667)](https://packagist.org/packages/mr-rijal/laravel-pipeline)[![PHP](https://camo.githubusercontent.com/bd33b80293f98e14a0999785ced4bb282e8a17bd8045a9de1038ada6f13e3506/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342d3737374242343f7374796c653d666c6174266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/bd33b80293f98e14a0999785ced4bb282e8a17bd8045a9de1038ada6f13e3506/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e342d3737374242343f7374796c653d666c6174266c6f676f3d706870266c6f676f436f6c6f723d7768697465)[![Latest Stable Version](https://camo.githubusercontent.com/1ab5d8a1719922c834649836aac14ed0e65ace0c31657a983f350c134b50a00c/68747470733a2f2f706f7365722e707567782e6f72672f6d722d72696a616c2f6c61726176656c2d706970656c696e652f76)](https://packagist.org/packages/mr-rijal/laravel-pipeline)[![License](https://camo.githubusercontent.com/cf67dfd710ba12f1fba0e85a29b40ea50532561d40a2c42bd0c4ab0d12f5d2f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d722d72696a616c2f6c61726176656c2d706970656c696e65)](LICENSE)[![Downloads](https://camo.githubusercontent.com/76e2d154dbf1b252970e7db3c01172ac79fd87b50125242f850915fc695bd0b0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d722d72696a616c2f6c61726176656c2d706970656c696e652e737667)](https://packagist.org/packages/mr-rijal/laravel-pipeline)[![Star](https://camo.githubusercontent.com/27f770bff6f55aa049237380e2b7f66d68b42ed7a89ea06969dcaafc9035be62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6d722d72696a616c2f6c61726176656c2d706970656c696e65)](https://github.com/mr-rijal/laravel-pipeline)

**Lightweight, enterprise-ready pipeline workflow engine for Laravel**Supports sequential, parallel, and flow-based execution with debug timeline, retries, timeouts, and queued parallelism.

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require mr-rijal/laravel-pipeline
```

Laravel **auto-discovers** the service provider. No manual registration required.

---

🛠️ Features
-----------

[](#️-features)

- Sequential, parallel, and flow pipelines
- Debug timeline with per-step execution metrics
- Retry failed steps with configurable attempts
- Step timeout support
- Parallel execution with optional queue (Redis/Horizon)
- Shared `LaravelPipelineContext` for passing data between steps
- Works with Closures or classes implementing `handle(LaravelPipelineContext $ctx)`
- PHPUnit + Testbench ready
- Lightweight, production-grade performance

---

🔧 Usage
-------

[](#-usage)

### 1️⃣ Basic Sequential Steps

[](#1️⃣-basic-sequential-steps)

```
use MrRijal\LaravelPipeline\Facades\LaravelPipeline;
use MrRijal\LaravelPipeline\DTO\LaravelPipelineContext;

LaravelPipeline::steps([
    fn (LaravelPipelineContext $ctx) => $ctx->set('foo', 'bar'),
    fn (LaravelPipelineContext $ctx) => $ctx->get('foo'), // returns 'bar'
])->run();
```

### 2️⃣ Flow (Continue on Fail)

[](#2️⃣-flow-continue-on-fail)

```
$results = LaravelPipeline::flow([
    fn() => true,
    fn() => false, // continue even if fails
    fn() => true
]);
```

### 3️⃣ Parallel (Run All at Once)

[](#3️⃣-parallel-run-all-at-once)

```
$results = LaravelPipeline::parallel([
    StepOne::class,
    StepTwo::class,
]);
```

---

🧰 Advanced Features
-------------------

[](#-advanced-features)

### Debug Timeline

[](#debug-timeline)

```
$pipeline = LaravelPipeline::steps([
    StepOne::class,
    StepTwo::class,
])->with(['user_id' => 5]);

$pipeline->run(); // or wrap in try/catch if steps may throw
$results = $pipeline->getResults();

foreach ($results as $step) {
    echo "{$step->name}: " . ($step->success ? '✔' : '✘') . " ({$step->time}ms)\n";
}
```

**Output Example:**

```
StepOne: ✔ (0.12ms)
StepTwo: ✘ (0.21ms) - Exception message if failed

```

---

### Retry &amp; Timeout

[](#retry--timeout)

Retry and timeout are currently supported via the `runStep()` method when building custom pipelines; a more convenient array format `[Step::class, 'retry' => 3, 'timeout' => 500]` is planned for a future release. See [docs](docs.md) for details.

---

### Queued Parallel Execution

[](#queued-parallel-execution)

```
LaravelPipeline::parallel([
    StepOne::class,
    StepTwo::class
], queue: true); // Dispatches steps to Laravel queue
```

- Works with Laravel **Redis queues or Horizon**
- Steps executed concurrently without blocking main thread

---

### Shared Pipeline Context

[](#shared-pipeline-context)

`LaravelPipelineContext` allows passing data between steps:

```
LaravelPipeline::steps([
    fn (LaravelPipelineContext $ctx) => $ctx->set('user_id', 123),
    fn (LaravelPipelineContext $ctx) => $ctx->get('user_id'), // 123
])->run();
```

---

⚡ Benchmark
-----------

[](#-benchmark)

```
vendor/bin/phpunit --filter BenchmarkTest
```

Typical performance (3-step pipeline):

- Sequential: &lt; 10ms (micro-benchmark)
- Memory usage: negligible
- Parallel queued execution depends on queue worker speed

---

💡 Step Types
------------

[](#-step-types)

1. **Closure**

```
fn (LaravelPipelineContext $ctx) => true
```

2. **Class with handle()** (class name or instance)

```
class StepOne
{
    public function handle(LaravelPipelineContext $ctx): bool
    {
        return true;
    }
}
```

3. **Boolean literal**

```
true // simple pass/fail (e.g. in flow())
```

---

🔧 Testing
---------

[](#-testing)

Run PHPUnit tests:

```
vendor/bin/phpunit
```

Includes:

- Sequential / flow / parallel tests
- Micro-benchmark tests

---

📝 Notes
-------

[](#-notes)

- Make sure queue workers are running when using `parallel(queue: true)`
- Use `getResults()` for detailed debugging or logging
- Step names are auto-detected from class name or “Closure”

---

💖 Sponsor
---------

[](#-sponsor)

If you find this project helpful, please consider [sponsoring my open source work](https://www.patreon.com/MrRijal) to help sustain development and maintenance!

Thank you for supporting open source software.

🔖 License
---------

[](#-license)

MIT © Prashant Rijal

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance80

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 53.8% of commits — single point of failure

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

108d ago

### Community

Maintainers

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

---

Top Contributors

[![mrthito](https://avatars.githubusercontent.com/u/49310993?v=4)](https://github.com/mrthito "mrthito (14 commits)")[![ax-prashant](https://avatars.githubusercontent.com/u/248839067?v=4)](https://github.com/ax-prashant "ax-prashant (6 commits)")[![mr-rijal](https://avatars.githubusercontent.com/u/94687531?v=4)](https://github.com/mr-rijal "mr-rijal (6 commits)")

---

Tags

phplaravelautomationevent-drivenlaravel-packageworkflowdesign patternsworkflow enginestate-machineclean architecturePHP Libraryorchestrationdeveloper-toolslaravel automationlaravel-workflowlaravel-pipelinetask-pipelinejob-pipelineprocess-automationstep-based-workflowbusiness-workflowmicroservice-pipelineenterprise-laravelbackend-toolstask-orchestration

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/mr-rijal-laravel-pipeline/health.svg)

```
[![Health](https://phpackages.com/badges/mr-rijal-laravel-pipeline/health.svg)](https://phpackages.com/packages/mr-rijal-laravel-pipeline)
```

###  Alternatives

[yorcreative/laravel-argonaut-dto

Argonaut is a lightweight Data Transfer Object (DTO) package for Laravel that supports nested casting, recursive serialization, and validation out of the box. Ideal for service layers, APIs, and clean architecture workflows.

1062.8k1](/packages/yorcreative-laravel-argonaut-dto)[jayesh/laravel-gemini-translator

An interactive command to extract and generate Laravel translations using Gemini AI.

691.7k1](/packages/jayesh-laravel-gemini-translator)[iamfarhad/laravel-rabbitmq

A robust RabbitMQ driver for Laravel Queue with advanced message queuing, reliable delivery, and high-performance async processing capabilities

3215.6k](/packages/iamfarhad-laravel-rabbitmq)[salehhashemi/laravel-repository

Implementing the repository pattern for Laravel projects.

2010.5k](/packages/salehhashemi-laravel-repository)[tarfin-labs/event-machine

Event-driven state machines for Laravel with event sourcing, type-safe context, and full audit trail.

188.5k](/packages/tarfin-labs-event-machine)

PHPackages © 2026

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