Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Pipeline Laravel Package

mpociot/pipeline

Lightweight PHP pipeline implementation (based on illuminate/pipeline) without requiring the Illuminate container. Send an object through an array of middleware/handlers and finish with a callback—useful for middleware-style request/command processing.

View on GitHub
Deep Wiki
Context7

Simple PHP pipelines

Frequently asked questions about Pipeline
How do I install mpociot/pipeline in a Laravel project?
Use Composer: `composer require mpociot/pipeline`. The package is framework-agnostic but mimics Laravel’s `illuminate/pipeline` API, so you can drop it into any project without Laravel dependencies. No additional configuration is needed.
Can I use this package outside Laravel (e.g., with Slim or Symfony)?
Yes, this package is designed to work independently of Laravel. It’s ideal for Slim, Symfony, or custom PHP applications needing middleware-style pipelines. The API (`send()`, `through()`, `then()`) is identical to Laravel’s.
What Laravel versions does mpociot/pipeline support?
The package is framework-agnostic, so it doesn’t tie to Laravel versions. However, it was originally based on Laravel 5.x’s `illuminate/pipeline`. For PHP 8.x compatibility, you may need polyfills or a fork, as the last update was in 2017.
How do I create a custom middleware for this pipeline?
Middleware must implement a `handle($data, Closure $next)` method. For example: `function handle($data, Closure $next) { return $next($data); }`. You can pass arrays of callables or objects with this method to `through()`.
Does this package support PSR-15 middleware?
Yes, you can wrap PSR-15 middleware using `Middleware::fromPsr15($psrMiddleware)`. This allows interoperability with frameworks like Slim or Symfony while using the pipeline’s API.
How do I handle errors or exceptions in the pipeline?
The package doesn’t include built-in exception handling. You must manually catch exceptions in your middleware or terminal callback. For pipeline-wide error handling, wrap the pipeline execution in a try-catch block.
Is this package suitable for async workflows (e.g., Promises)?
No, this package is synchronous-only. For async pipelines, integrate with libraries like `spatie/async-pipeline` or `react/promise` to handle parallel or deferred middleware execution.
What are the alternatives to mpociot/pipeline?
Consider `league/pipeline` (actively maintained, PSR-15 compliant) or `php-pipeline` (modern, async-capable). If you need Laravel’s full pipeline, use `illuminate/pipeline` directly. For CLI tools, `symfony/console` also offers pipeline-like features.
How do I test middleware in this pipeline?
Mock the pipeline’s `send()` and `through()` methods in your tests. Use PHPUnit to verify middleware behavior by passing test data through the pipeline and asserting the output. Example: `Pipeline::send($data)->through([$middleware])->then(fn($result) => $this->assertEquals(...));`
Will this package work in production with high traffic?
Yes, benchmarks show minimal overhead compared to manual chaining. However, for I/O-bound workflows (e.g., API calls), consider async alternatives. The package is stateless and thread-safe, making it suitable for high-throughput systems.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope