PHPackages                             mshule/laravel-pipes - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. mshule/laravel-pipes

ActivePackage[Mail &amp; Notifications](/categories/mail)

mshule/laravel-pipes
====================

A description for laravel-pipes.

v1.3.0(5y ago)211.4k3[2 issues](https://github.com/m-shule/laravel-pipes/issues)[1 PRs](https://github.com/m-shule/laravel-pipes/pulls)MITPHP

Since May 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/m-shule/laravel-pipes)[ Packagist](https://packagist.org/packages/mshule/laravel-pipes)[ RSS](/packages/mshule-laravel-pipes/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (4)Versions (19)Used By (0)

laravel-pipes
=============

[](#laravel-pipes)

[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0215477eca52839e0c3d49ca5b3cdf7e07b6b6f37fa61e0576d29fd07da7cfc1/68747470733a2f2f7472617669732d63692e6f72672f6d2d7368756c652f6c61726176656c2d70697065732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/m-shule/laravel-pipes)[![codecov](https://camo.githubusercontent.com/935074c9066e9a9f0fae2f806892a591d50548ca2679dac74a9249d680ef4bd4/68747470733a2f2f636f6465636f762e696f2f67682f6d2d7368756c652f6c61726176656c2d70697065732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/m-shule/laravel-pipes)[![Total Downloads](https://camo.githubusercontent.com/39dfb8984edc09a291691fc0b155e73f5f4d02387d3e4dcbc8dd7b00bcc0d083/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d7368756c652f6c61726176656c2d70697065732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mshule/laravel-pipes)

Handling notifications from API's is simple when they only require to handle one type of notification, but if you have to handle multiple requests e.g. from an SMS API it can get messy. Similar to [Botman](https://botman.io)'s hear() method, this package provides a slightly different approach which could be used as part of another Botman like implementation. This package offers a similar API as you are used to from the [Laravel Routes](https://laravel.com/docs/5.8/routing).

Install
-------

[](#install)

`composer require mshule/laravel-pipes`

The incoming web request will be handled by `your_app_domain` + whatever you put in the `pipes.incoming_request_path` config. By default, the path will result in `your_app_domain/handle-notification`.

**Optional: Create a separate route file for your pipes.**

1. add a new file `routes/pipes.php`
2. set the `pipes.load_routes_file` to `true`

Usage
-----

[](#usage)

To get an overview of all functionalities this package offers, you can check the `tests/PipeRequestTest.php`.

### Handling Pipes

[](#handling-pipes)

Pipes are matched by the keys and values of the request's data attributes.

```
// define pipe match for `foo` => `bar`
// key, value, action
Pipe::match('foo', 'bar', function () {
  return 'matched';
});

// same as
Pipe::match('foo:bar', function () {
  return 'matched';
})

$this->pipe(['foo' => 'bar'])
  ->assertSee('matched'); // true
```

Attributes can be bound dynamically to the pipe-request.

```
Pipe::match('foo:{bar}', function ($bar) {
  return $bar;
});

$this->pipe(['foo' => 'bar'])
  ->assertSee('bar'); // true

$this->pipe(['foo' => 'other'])
  ->assertSee('other'); // true
```

Instead of handling all pipe requests inside a callback, you can also redirect to a controller action.

```
Pipe::match('foo:{bar}', 'SomeController@index');
```

If you want to handle multiple requests with different attribute keys you can use the `Pipe::any()` method.

```
Pipe::any('{bar}', 'SomeController@index');
```

### Other Options

[](#other-options)

**alias()**Sometimes the user might have a typo in their message or you simply want to have different cues available to trigger a Pipe.

```
Pipe::any('bar', 'FooBarController')
  ->alias(['ba', 'b-r', 'bas']);
```

The `FooBarController` will now be called upon `ba`, `b-r`, `bas` or as originally intended on `bar`.

**namespace()**As you have probably noted the `routes/pipes.php` file is bound to a namespace configurable in the `config/pipes.php`. If you want to define a group with a different namespace, you can use the `namespace()` method:

```
Pipe::middleware('pipe')
  ->namespace(config('pipes.namespace'))
  ->group(function () {
    // define your namespaced pipes here
  });
```

**key()**Like demonstrated in the first section of the *Handling Pipes* documentation, you can define Pipe routes in man different ways.

```
Pipe::match('foo', 'bar', function () {});

// same as
Pipe::match('foo:bar', function () {});
```

There is a third option to specify the `key` of a Pipe by using the `key()` method.

```
Pipe::key('foo')->match('bar', function () {});
```

The key method is handy if you have got several pipe routes which react to the same key.

```
Pipe::key('text')
  ->group(function () {
    // all pipe definitions within here will check for the `text` as key in the incoming request
    Pipe::match('some-text', function () {});
  });
```

**where()**To further specify which request should be sent to a specific handler you can define conditions on each pipe like you are used to with [Laravel routes](https://laravel.com/docs/5.8/routing#parameters-regular-expression-constraints).

```
Pipe::any('{foo}', function ($foo) {
  return $foo;
})->where('foo', 'bar');

Pipe::any('{foo}', function ($foo) {
  return $foo;
})->where('foo', '[a-z]+');
```

**Understanding Pipe Life Cycle**

The laravel-pipes lifecycle starts with a `post` request which is sent to the `pipes.incoming_request_path`. The `ExecutePipeRequest` Job is dispatched and an HTTP response returned - this is important since the pipe request is handled asynchronously if you have another queue driver than `sync`. In the Job, the `$request` is passed to the Pipe-Kernel's `handle()` method where it is passed through the global pipe-middlewares. The request is matched with the registered pipes and if a match is found the response is returned, otherwise a `NotFoundPipeException` is thrown.

**Define the queue**

As explained in the section above, a job is triggered to start the pipe-lifecycle. With the `pipes.queue` option you can define a seperate queue to run the pipe job on.

**Testing Pipes**

This package provides a simple trait to perform pipe requests. The `MakesPipeRequests` Trait provides a `pipe()` method to perform a pipe-request. The method fires a `post` request to the specified endpoint in `pipes.incoming_request_path`, but it is much easier to write `$this->pipe(...)` than `$this->post(config('pipes.incoming_request_path), [...])`.

Since the pipe request is executed through a job, you have to use the `Pipe::fake()` method to get access to your responses.

```
Pipe::fake();

$this->pipe(...);

Pipe::assertResponded(function ($response) {
  $response->assertOk()
    ->assertSee(...);
});
```

Behind the scenes the `Pipe::fake()` method simply triggers the `Event::fake()` with the `IncomingPipeRequest` and `IncomingPipeResonse` events.

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

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

License
-------

[](#license)

The MIT License (MIT). Please see [License File](/LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 80.9% 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 ~42 days

Recently: every ~68 days

Total

16

Last Release

1919d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/60754583daa35a820f801953ab085781a2fcd50f878a2f08e55482b572d75b48?d=identicon)[mshule](/maintainers/mshule)

---

Top Contributors

[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (72 commits)")[![ejimba](https://avatars.githubusercontent.com/u/5405838?v=4)](https://github.com/ejimba "ejimba (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (1 commits)")

---

Tags

incoming-webhookslaravelnotificationslaravel

### Embed Badge

![Health badge](/badges/mshule-laravel-pipes/health.svg)

```
[![Health](https://phpackages.com/badges/mshule-laravel-pipes/health.svg)](https://phpackages.com/packages/mshule-laravel-pipes)
```

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[tzsk/sms

A robust and unified SMS gateway integration package for Laravel, supporting multiple providers.

320244.3k6](/packages/tzsk-sms)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)

PHPackages © 2026

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