Table of Contents
Copy php class file
Copy the file tinyrouter.class.php somewhere into your project.
In your php script reference its location, e.g.
// load the class
require_once('../classes/tinyrouter.class.php');
Enable pretty print url
Optional: you can redirect all incoming requests in subdir /api to the index.php that will use the router.
On Apache httpd this feature needs enabled mod_rewrite module.
<Location "/api">
Require all granted
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api(/.*)$ index.php?request=$1
</Location>
Example urls:
without pretty print:
http://localhost/api/index.php?request=/apps/12345/meta
with pretty print:
http://localhost/api/apps/12345/meta