PHPackages                             slaxweb/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. [Framework](/categories/framework)
4. /
5. slaxweb/router

ActiveLibrary[Framework](/categories/framework)

slaxweb/router
==============

Router component for the SlaxWeb/Framework

0.6.0(9y ago)05942MITPHPPHP &gt;=7.0.0

Since Feb 10Pushed 9y ago2 watchersCompare

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

READMEChangelogDependencies (9)Versions (8)Used By (2)

Router
======

[](#router)

[![Build Status](https://camo.githubusercontent.com/7aa8b9283df3b237c12d6d418767cce2dca2482fd4cc4179dd5659eedaea468c/68747470733a2f2f7472617669732d63692e6f72672f536c61785765622f526f757465722e7376673f6272616e63683d302e332e30)](https://travis-ci.org/SlaxWeb/Router)

The Router Component is one of the core components of the SlaxWeb/Framework, but it can be used separately as well. It relies on the following components:

- [Logger](https://github.com/SlaxWeb/Logger)
- [Hooks](https://github.com/SlaxWeb/Hooks)
- [Config](https://github.com/SlaxWeb/Config)
- [Symfony HTTP Foundation](https://github.com/symfony/http-foundation)

The Router helps you route your incoming requests to the correct code, and is one of the essential components in modern web applications, especially those who rely on a single entry point. With a Router, you control where your incoming requests are handled.

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

[](#installation)

Installation is currently available only through composer, and can be achieved by putting the following into your *composer.json* file:

```
"require": {
    "slaxweb/router": "0.4.*@dev"
},
"minimum-stability": "dev"
```

Usage
-----

[](#usage)

Initialization of the Router can be a little bit overwhelming, especially because it relies on two other components, which also need to be initialized separately. Because of this, the Router provides two convenient ways of initializing it, a Factory and a Service Provider if you happen to use the Pimple Dependency Injection Container.

This is just to get you started. Full documentation will follow in the future.

### Factory

[](#factory)

The Factory provides static methods to initialize the Router properly, and help you get your Route definitions to the Router. This example does not show how to prepare the Config component, which is required by the Logger component. For this please refer to the Config and Logger components.

```
