Kuzu Balığı

Kuzu Balığı

Overriding the request method

Use X-HTTP-Method-Override to override the HTTP Request Method. Only works when the original Request Method is POST. Allowed values for X-HTTP-Method-Override are PUTDELETE, or PATCH.

Subfolder support

Out-of-the box bramus/router will run in any (sub)folder you place it into … no adjustments to your code are needed. You can freely move your entry script index.php around, and the router will automatically adapt itself to work relatively from the current folder's path by mounting all routes onto that basePath.

Say you have a server hosting the domain www.example.org using public_html/ as its document root, with this little entry script index.php:

$router->get('/', function() { echo 'Index'; });
$router->get('/hello', function() { echo 'Hello!'; });
  • If your were to place this file (along with its accompanying .htaccess file or the like) at the document root level (e.g. public_html/index.php), bramus/router will mount all routes onto the domain root (e.g. /) and thus respond to https://www.example.org/ and https://www.example.org/hello.

  • If you were to move this file (along with its accompanying .htaccess file or the like) into a subfolder (e.g. public_html/demo/index.php), bramus/router will mount all routes onto the current path (e.g. /demo) and thus repsond to https://www.example.org/demo and https://www.example.org/demo/hello. There's no need for $router->mount(…) in this case.