1. Go to this page and download the library: Download sparhandy/pipeandfilter 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/ */
sparhandy / pipeandfilter example snippets
// Implements \Sparhandy\PipeAndFilter\FilterInterface
$exampleFilterFoo = new Acme\Filter\Foo();
$exampleFilterBar = new Acme\Filter\Bar();
$exampleFilterBaz = new Acme\Filter\Baz();
$filters = [
$exampleFilterFoo,
$exampleFilterBar,
$exampleFilterBaz,
];
$factory = new \Sparhandy\PipeAndFilter\PipeFactory();
$pipe = $factory->build($filters);
// The variable, to be processed by the $filters
$context = [];
// The context, to be processed by the $filters
$someParameter = [
'foo' => 'bar',
];
$pipe->run($context, $someParameter);
// $context is now modified by your filters.
class FooFilter implements Sparhandy\PipeAndFilter\FilterInterface
{
/**
* @param mixed $context
* @param mixed[] $someParameter
*
* @return void
*/
public function execute(&$context, array $someParameter)
{
if (isset($context['foo']))
{
$context['bar'] = $someParameter['baz'];
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.