This repository has been archived on 2025-04-13 . You can view files and clone it, but cannot push or open issues or pull requests.
Route
Minimalistic Web Application Router
Installation
Composer
Composer needs to know where to locate the package. Add the repository to your project by declaring it in the composer.json
file.
{
"repositories": [
{
"type": "vcs",
"url": "https://git.willy.club/WillySoft/Route"
}
],
"require": {
"willysoft/route": "dev-master"
}
}
Fetch the package by running
composer install
Manual
Its all in a single file; include it in your project like so
require '/change_this/Route.php'
Usage
See example.php
Access directly
The simplest way to access your routes. Just put the file in your favorite folder and run it!
For example
http://your.site/folder/index.php/route
Rewrite requests
The more sexy way of doing it.
For example
http://your.site/route
NGINX
With PHP already configured, add this to the server block of your configuration to make requests that don't match a file on your server to be sent to your front controller and begin routing.
location / {
try_files $uri $uri/ /index.php?$query_string;
}
Languages
PHP
100%