1. Go to this page and download the library: Download slince/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/ */
use Psr\Http\Message\ServerRequestInterface;
use Interop\Http\Server\MiddlewareInterface;
use Interop\Http\Server\RequestHandlerInterface;
use Zend\Diactoros\Response;
class MyMiddleware implements MiddlewareInteface
{
public function process(ServerRequestInterface $request, RequestHandlerInterface $next)
{
$response = new Response();
$response->getBody()->write('hello world');
return $response;
}
}
$dispatcher = new Slince\Middleware\Dispatcher([
new MyMiddleware()
]);