PHP code example of innmind / stack

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

    

innmind / stack example snippets


use function Innmind\Stack\stack;

$decorate = stack(
    static function(RequestHandler $handler) {
        return new ValidateRequest($handler);
    },
    static function(RequestHandler $handler) {
        return new Security($handler);
    }
);
$handler = $decorate(new MyRequestHandler);

$handler = new ValidateRequest(
    new Security(
        new MyRequestHandler
    )
);