Minimal PHP Router
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
William 58a99cded1
Update 'composer.json'
7 days ago
LICENSE Init 1 week ago Init 1 week ago
Route.php Better solution for groups without a prefix 1 week ago
composer.json Update 'composer.json' 7 days ago
example.php Better solution for groups without a prefix 1 week ago


Minimal PHP Router



Composer needs to know where to locate the package. Let's add the repository to your project by declaring it in the composer.json file.

    "repositories": [
            "type": "vcs",
            "url": ""
    "require": {
        "willysoft/route": "dev-master"

Fetch the package by running

composer install


When using a production web server such as Nginx you will have to tell it to rewrite requests that don't point to a local file, such as they can be forwarded to your front controller which in this case is public/index.php.

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;

See example.php and add it to your public/index.php file. It will act as the front controller.