The simplest way to test a PHP application is to use the built-in PHP Server. It works quite well, but it needs to know if the router script didn't find a result and if it needs to check for a file. This works by not echoing anything and returning false.
Easiest way is to change this in the routes.php file. You could add a check if a file exists or not to make the 404 page work if needed.
Edit: If the routes capture destinations where files exist, then this won't work.
Alternatively placing the following at the beginning of routes.php would help.
This might need more input sanitization before it can be used:
if (php_sapi_name() === 'cli-server') {
$fileName = __DIR__.parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
if (file_exists($fileName) && !is_dir($fileName)) return false;
}
The simplest way to test a PHP application is to use the built-in PHP Server. It works quite well, but it needs to know if the router script didn't find a result and if it needs to check for a file. This works by not echoing anything and returning false.
Easiest way is to change this in the routes.php file. You could add a check if a file exists or not to make the 404 page work if needed.
php -S 127.0.0.1:8000 routes.php
Edit: If the routes capture destinations where files exist, then this won't work. Alternatively placing the following at the beginning of routes.php would help. This might need more input sanitization before it can be used: