PHPackages                             ifcanduela/router - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ifcanduela/router

ActiveLibrary

ifcanduela/router
=================

A routing component wrapping FastRoute

1.1.0(4y ago)01561MITPHP

Since Sep 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ifcanduela/router)[ Packagist](https://packagist.org/packages/ifcanduela/router)[ RSS](/packages/ifcanduela-router/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

Router
======

[](#router)

PHP router wrapping `nikic/fast-route`, with support for nested route groups, default parameters and a few other extra features.

Installation
------------

[](#installation)

Use [Composer](https://getcomposer.org):

```
composer require ifcanduela/router
```

Usage
-----

[](#usage)

Create an `ifcanduela\router\Router` instance and define routes:

```
$router = new ifcanduela\router\Router();
$router->get("/")->to("my_controller");
```

Loading routes from a file
--------------------------

[](#loading-routes-from-a-file)

Loading routes from a file is the preferred method to initialise a router. Create a file like this, for example `routes.php`:

```
