1. Go to this page and download the library: Download veasin/nx-tiny-franken 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/ */
veasin / nx-tiny-franken example snippets
// franken.php - FrankenPHP worker entry point
put, route};
container('count', 0);
franken(function () {
log(from('uri', 'input'));
route([
'get:/' => fn() => output('hello world!', 'http'),
'get:/hi' => fn() => output('hi~', 'http'),
'get:/count' => function () {
$count = container('count') + 1;
output("count: $count", 'http');
container('count', $count);
},
]);
}, function () {
// cleanup on each request cycle end
});