PHPackages                             corbosman/laravel-pipeline-passable - 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. [Framework](/categories/framework)
4. /
5. corbosman/laravel-pipeline-passable

ActiveLibrary[Framework](/categories/framework)

corbosman/laravel-pipeline-passable
===================================

A Passable class for Laravel's Pipeline

2.0.0(4y ago)0206MITPHPPHP &gt;=8.0.2

Since Dec 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/corbosman/laravel-pipeline-passable)[ Packagist](https://packagist.org/packages/corbosman/laravel-pipeline-passable)[ Docs](https://github.com/corbosman/laravel-pipeline-passable)[ RSS](/packages/corbosman-laravel-pipeline-passable/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (4)Versions (5)Used By (0)

Passable
========

[](#passable)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6792cf9781b3a6521734f7280cc22dd87e578f59408c3345e13f7683af959ea4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f72626f736d616e2f6c61726176656c2d706970656c696e652d7061737361626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/corbosman/laravel-pipeline-passable)[![Total Downloads](https://camo.githubusercontent.com/fcaf27d5ab0fc18c6e36db1116e42958d55ff5eee0f7952f21aad8a4cf46b406/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f72626f736d616e2f6c61726176656c2d706970656c696e652d7061737361626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/corbosman/laravel-pipeline-passable)

Laravel's Pipeline class only takes a single input parameter. This unfortunately limits how you can use that class to your advantage. This is an opinionated solution using a Passable class that extends [Spatie's Data Transfer Object](https://github.com/spatie/data-transfer-object). It's just something I needed myself in several projects, so I extracted it to a package.

Installation
------------

[](#installation)

Via Composer

```
$ composer require corbosman/laravel-pipeline-passable
```

Usage
-----

[](#usage)

You should be familiar on how Laravel Pipelines work. They're used in the Router and Middleware. It lets you pass a variable through a set of classes, and return the result. Sort of like array\_reduce. Since you can't pass in multiple variables, it's not possible to send in some kind of input and output that are separate. That's where this package comes in. It allows you to create a class with multiple properties, and in the end return one of the properties as the result of the pipeline. By default, it just returns the class itself as the result, but you can implement a *return* method that returns whatever you want.

This package extends Spatie's DataTransferObject, so you can check their docs on how you can instantiate this class. It helps to understand what a DTO is and how you can use it. There is two common patterns, you either pass your class properties through the constructor, or you create a static method.

### Constructor

[](#constructor)

```
use CorBosman\Pipeline\Passable;

class MyPipeline extends Passable
{
    public string $username;
    public array $output;

    public function return() : array
    {
        return $this->output;
    }
}
```

To use this pipeline, construct it using the properties as parameters, then give it some classes to pipe through.

```
$output = (new MyPipeline(['username' => $foo, 'output' => []])->pipeline([
    PipeClass1::class,
    PipeClass2::class
    ...
]);
```

### Factory

[](#factory)

Sometimes it's easier to use a factory method. For example, you can use it to initialise a response DataTransferObject.

```
use CorBosman\Pipeline\Passable;

class MyPipeline extends Passable
{
    public string $username;
    public Output $output;

    public static function factory($username) : self
    {
        return new self([
            'username' => $username,
            'output'   => new Output
        ]);
    }

    public function return() : array
    {
        return $this->output->toArray();
    }
}
```

```
$output = MyPipeline::factory($username)->pipeline([
    PipeClass1::class,
    PipeClass2::class
    ...
]);
```

Pipeline classes
----------------

[](#pipeline-classes)

To send this Passable through Laravel's Pipeline, you call the *pipeline* method with an array of classes. Just like with middleware classes, you have to make sure that your class calls the next class, as shown in the examples below. The Pipeline class allows several different options.

- Normal class with a handle method

```
class Uppercase
{
    public function handle(MyPipeline $passable, $next)
    {
        $passable->output = strtoupper($passable->username);

        return $next($passable);
    }
}
```

- An invokable class

```
class Uppercase
{
    public function __invoke(MyPipeline $passable, $next)
    {
        $passable->output = strtoupper($passable->username);

        return $next($passable);
    }
}
```

- An object, note that the object should have the handle method on it

```
$uppercase = new Uppercase;
$result = MyPipeline::factory($input)->pipeline([$uppercase]);
```

### Changing the called method

[](#changing-the-called-method)

By default the **handle()** method is called on each pipeline class. If you want to override that, you can set the method name as the second parameter of the **pipeline()** method.

```
$result = MyPipeline::factory($input)->pipeline([...], 'filter');
```

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Cor Bosman](https://github.com/corbosman)
- [All Contributors](../../contributors)

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

1534d ago

Major Versions

0.0.2 → 1.0.02020-12-10

1.0.0 → 2.0.02022-03-01

PHP version history (2 changes)0.0.2PHP &gt;=7.4

2.0.0PHP &gt;=8.0.2

### Community

Maintainers

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

---

Tags

laravelpipeline

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/corbosman-laravel-pipeline-passable/health.svg)

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

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k96.9M674](/packages/laravel-socialite)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[laravel/ui

Laravel UI utilities and presets.

2.7k134.9M601](/packages/laravel-ui)[laravel/sail

Docker files for running a basic Laravel application.

1.9k186.9M1.0k](/packages/laravel-sail)[laravel/jetstream

Tailwind scaffolding for the Laravel framework.

4.1k19.8M136](/packages/laravel-jetstream)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)

PHPackages © 2026

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