Phanda_PathTranslator
This class supports cool URI., (*1)
Examples
/.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* __gateway.php [L]
/__gateway.php
<?php
Phanda_PathTranslator::getInstance()->initialize()
->setParameterDirectoryName('%VAR%')
->setSearchExtensions('php')
->execute();
If /categories/1/items/2/detail.json is requested,, (*2)
directory is changed to /categories/%VAR%/items/%VAR%/ in the document root and detail.php is included., (*3)
And then environment variables (PHP_SELF, SCRIPT_NAME, SCRIPT_FILENAME, PATH_INFO, PATH_TRANSLATED) is rewritten., (*4)
/categories/%VAR%/items/%VAR%/detail.php
<?php
$translator = Phanda_PathTranslator::getInstance();
$categoryId = $translator->getParameter(0); // '1'
$itemId = $translator->getParameter(1); // '2'
$extension = $translator->getExtension(); // 'json'
This project stopped updating.
https://github.com/k-holy/Volcanus_Routing inherits this project., (*5)