PHPackages                             mlboy/macaw - 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. mlboy/macaw

ActiveLibrary[Framework](/categories/framework)

mlboy/macaw
===========

Sexy PHP router.

012PHP

Since Feb 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/mlboy/Macaw)[ Packagist](https://packagist.org/packages/mlboy/macaw)[ RSS](/packages/mlboy-macaw/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Macaw
=====

[](#macaw)

Macaw is a simple, open source PHP router. It's super small (~150 LOC), fast, and sexy. This class allows you to jus throw it into your project and start using it immediately.

### Install

[](#install)

If you have Composer, just include Macaw 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: {
    "noahbuscher/macaw": "dev-master"
}

```

### Examples

[](#examples)

First, `use` the Macaw namespace:

```
use \NoahBuscher\Macaw\Macaw;
```

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

```
Macaw::get('/', function() {
  echo 'Hello world!';
});

Macaw::dispatch();
```

Macaw also supports lambda URIs, such as:

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

Macaw::dispatch();
```

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

```
Macaw::get('/', function() {
  echo 'I
