PHP code example of isholao / middleware

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

    

isholao / middleware example snippets





Dummy 

{
    function __construct(string $dummy)
    {
        $this->dummy = $dummy;
    }
}

$manager = new \Isholao\Middleware\Manager(function($dummy){
    return new Dummy($dummy);
},Dummy::class);

$manager->register(function($dummy,$next){
    return $next($dummy);
});

$manager->call('dummy');