PHPackages                             mombol/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. mombol/router

ActiveLibrary[Framework](/categories/framework)

mombol/router
=============

a php router base on Macaw

1.0.4(10y ago)026MITPHP

Since Apr 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/mombol/php-router)[ Packagist](https://packagist.org/packages/mombol/router)[ RSS](/packages/mombol-router/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (6)Used By (0)

Router
======

[](#router)

Router is a simple, open source PHP router base on macaw. It's super small (~150 LOC), fast, and has some great annotated source code. This class allows you to just throw it into your project and start using it immediately.

### Install

[](#install)

If you have Composer, just include Router as a project dependency in your `composer.json`. If you don't just install it by downloading the .ZIP file and extracting it to your project directory.

```
require: {
    "mombol/router": "^1.0"
}

```

### Examples

[](#examples)

First, `use` the Router namespace:

```
use \Mombol\Router\Router;
```

Router is not an object, so you can just make direct operations to the class. Here's the Hello World:

```
Router::get('/', function() {
  return 'Hello world!';
});
```

Router also supports lambda URIs, such as:

```
Router::get('/(:any)', function($slug) {
  return 'The slug is: ' . $slug;
});
```

You can also make requests for HTTP methods in Router, so you could also do:

```
Router::get('/', function() {
  return 'I
