1. Go to this page and download the library: Download mix-plus/http-server 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/ */
mix-plus / http-server example snippets
$server = new Mix\Http\Server\Server('0.0.0.0', 9596, false, false);
$server->handle('/', function (\Mix\Http\Message\ServerRequest $request, \Mix\Http\Message\Response $response) {
$response->withBody(new \Mix\Http\Message\Stream\ContentStream('hello, world!'));
$response->send();
});
$server->start();
$process = function (ServerRequest $request, Response $response) use ($result) {
// ...
return $response;
};
$dispatcher = new MiddlewareDispatcher($middleware, $process, $request, $response);
$response = $dispatcher->dispatch();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.