PHP code example of fitdev-pro / middleware

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

    

fitdev-pro / middleware example snippets



    $hundler = new MiddlewareHundler(new Resolver(), new Queue());

    $hundler->append(Foo/Bar/SomeClass::class);

    $hundler->append(function ($input, $output, $next){
       $data += 1;

       return $next($data);
    });

    $hundler->append(function ($input, $output, $next){
        $data += 2;

        if($data > 4){
            return $data;
        }
        
        return $next($data);
    });

    $hundler->append(function ($input, $output, $next){
        $data += 3;

        return $next($data);
    });
    
    $newData = $hundler->hundle(2);