PHP code example of mshule / laravel-pipes

1. Go to this page and download the library: Download mshule/laravel-pipes library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mshule / laravel-pipes example snippets


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

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

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

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

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

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

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

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

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

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

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

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 () {});
  });

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

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

Pipe::fake();

$this->pipe(...);

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