PHP code example of ellipse / middleware

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

    

ellipse / middleware example snippets




namespace App;

use Ellipse\Middleware\MiddlewareStack;

// Create a middleware stack. (LIFO order)
$stack = new MiddlewareStack([new SomeMiddleware2, new SomeMiddleware1]);

// The request goes through middleware1, middleware2, then hit the request handler.
$response = $stack->process($request, new SomeHandler);



namespace App;

use Ellipse\Middleware\MiddlewareQueue;

// Create a middleware queue. (FIFO order)
$queue = new MiddlewareQueue([new SomeMiddleware1, new SomeMiddleware2]);

// The request goes through middleware1, middleware2, then hit the request handler.
$response = $queue->process($request, new SomeHandler);