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::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]+');