⚙️
Minimul setup
# index.php
require_once __DIR__ . './vendor/prototype/autoload.php';
route('foo', '/', function () {
return redirect('bar', ['baz' => 'prototype'], true);
}, ['GET']);
route('bar', '/bar/', function () {
return 'Try out ' . $_GET['baz'] . ' now!';
}, ['GET']);
serve('https://mortal.app', 80);
# .htaccess // Apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
IfModule>
# nginx.conf // Ngix
location = /index.php { }
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php break;
}
}
📦
Structured enviroment
root
|-- vendor/
| `-- prototype/
| |-- autoload.php
| |-- firewall.php
| |-- router.php
| |-- templater.php
| `-- utils.php
|
|-- static/
| `-- favicon.png
|
|-- templates/
| `-- home.php
|
|-- .htaccess
`-- index.php
4 directories, 8 files