PHP code example of kittenphp / pipeline

1. Go to this page and download the library: Download kittenphp/pipeline 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/ */

    

kittenphp / pipeline example snippets



kitten\Component\pipeline\MiddlewareInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use kitten\Component\pipeline\PipelinePack;

class M1 implements MiddlewareInterface{
    public function handle(Request $request, Closure $next)
    {
        // Some processing work...
        return $next($request);
    }
}
class M2 implements MiddlewareInterface{
    public function handle(Request $request, Closure $next)
    {
        return new Response('hello world! (kitten\Component\pipeline)');
    }
}

$pack=new PipelinePack();
$pack->add(new M1());
$pack->add(new M2());
$response=$pack->handle(Request::createFromGlobals());
$response->send();