1. Go to this page and download the library: Download talesoft/tale-http-runtime 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/ */
talesoft / tale-http-runtime example snippets
class HelloMiddleware implements MiddlewareInterface
{
public function __invoke(
ServerRequestInterface $request,
ResponseInterface $response,
callable $next
)
{
$response->getBody()->write('Hello ');
return $next($request, $response);
}
}
class WorldMiddleware implements MiddlewareInterface
{
public function __invoke(
ServerRequestInterface $request,
ResponseInterface $response,
callable $next
)
{
$response = $next($request, $response);
$response->getBody()->write('World!');
return $response;
}
}
class FuckingMiddleware implements MiddlewareInterface
{
public function __invoke(
ServerRequestInterface $request,
ResponseInterface $response,
callable $next
)
{
$response->getBody()->write('fucking ');
return $next($request, $response);
}
}
$queue = new Queue();
$queue->append(new HelloMiddleware())
->append(new WorldMiddleware())
->append(new FuckingMiddleware());
Runtime::emit($queue); //(Output) "Hello fucking World!"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.