1. Go to this page and download the library: Download slogsdon/fp-web 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/ */
slogsdon / fp-web example snippets
\FPWeb\App;
use \FPWeb\Route;
// index handler
$index = function ($conn) {
// TODO: make this process nicer
$conn['response']['body'] = 'index';
return $conn;
};
// create routes
$routes = [
Route\get('/index', $index),
];
// match request and run match
$response = App\run($routes, [
'param_set' => [$_GET, $_POST],
'on_error' => function ($conn) {
$conn['response']['body'] = 'Not Found';
return $conn;
},
]);
printf('<pre><code>%s</code></pre>', print_r($response, true));
$ git clone https://github.com/slogsdon/php-fp-web
$ cd php-fp-web
$ composer install
$ php -S 0.0.0.0:8888 -t example
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.