PHPackages                             jamierumbelow/pigeon - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. jamierumbelow/pigeon

ActiveLibrary[HTTP &amp; Networking](/categories/http)

jamierumbelow/pigeon
====================

Intelligent, elegant routing for CodeIgniter

v0.2.0(13y ago)11029.2k↓50%24[8 issues](https://github.com/jamierumbelow/pigeon/issues)MITPHPPHP &gt;=5.3.1

Since Sep 25Pushed 8y ago8 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

DEPRECATED: Pigeon
==================

[](#deprecated-pigeon)

### Intelligent, elegant routing for CodeIgniter

[](#intelligent-elegant-routing-for-codeigniter)

[![No Maintenance Intended](https://camo.githubusercontent.com/d904056147052e22d8e1c7f46bb50293ed2aeb4c43ead9a2d0cf7a48b46d0562/687474703a2f2f756e6d61696e7461696e65642e746563682f62616467652e737667)](http://unmaintained.tech/)

CodeIgniter's routing engine is *far too basic*. Pigeon wraps around the core routing system to provide HTTP method based routing, RESTful resources and nested routes. It uses a natural DSL to make writing cleverer routes simple and elegant.

Synopsis
--------

[](#synopsis)

```
Pigeon::map(function($r){
	$r->route('posts/(:num)', 'posts/show/$1');

	$r->get('posts', array( 'Posts', 'index' ));
	$r->post('posts', 'Posts#create' );
	$r->put('posts/(:num)', array( 'Posts', 'update' ));
	$r->delete('posts/(:num)', array( 'Posts', 'delete' ));

	$r->resources('posts');

	$r->resources('posts', function($r){
		$r->resources('comments');
	});
});

$route = Pigeon::draw();

```

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

[](#installation)

Install with [Composer](http://getcomposer.org/). Install Composer for your project:

```
$ curl -s http://getcomposer.org/installer | php

```

...and create/edit your `composer.json`:

```
{
    "require": {
        "jamierumbelow/pigeon": "*"
    }
}

```

...and install it!

```
$ php composer.phar install

```

Remember to include Composer's autoload file in `index.php`:

```
require_once './vendor/autoload.php';

```

Alternatively, download and drag the **Pigeon.php** file into your *application/libraries* folder. Autoload the library and away you go.

How It Works
------------

[](#how-it-works)

You define your routes using Pigeon's DSL inside your *config/routes.php* file. Pigeon builds up the routes array internally; to expose it to CodeIgniter, you need to set the standard `$route` variable using `draw()`:

```
$route = Pigeon::draw();

```

Remember to do this **after you define your routes**.

Basic routing
-------------

[](#basic-routing)

The most basic routing mechanism is the `route` method. You can pass through a traditional CodeIgniter routing pattern here:

```
$r->route('posts/(:num)', 'posts/show/$1');

```

The `route` method also allows a `controller#action` input:

```
$r->route('posts/(:num)', 'posts#show');

```

You can also pass through an array of the controller and action:

```
$r->route('posts/(:num)', array( 'Posts', 'show' ));

```

HTTP Verb Routing
-----------------

[](#http-verb-routing)

Pigeon also allows you to only route to a certain function when an HTTP verb is used. This is particularly useful when creating a RESTful system:

```
$r->get('posts/(:id)', 'posts/show/$1');
$r->post('posts', 'posts/create');
$r->put('posts/(:id)', 'posts/update/$1');
$r->delete('posts/(:id)', 'posts/delete/$1');
$r->patch('posts/(:id)', 'posts/delete/$1');
$r->head('posts/(:id)', 'posts/delete/$1');
$r->options('posts/(:id)', 'posts/delete/$1');

```

RESTful Resources
-----------------

[](#restful-resources)

Pigeon supports RESTful resource based routes. A simple call to `resources` will generate a bunch of routes to facilitate a RESTful style application:

```
$r->resources('posts');

```

...is the same as:

```
$r->get('posts', 'posts/index');
$r->get('posts/new', 'posts/create_new');
$r->get('posts/(:any)/edit', 'posts/edit/$1');
$r->get('posts/(:any)', 'posts/show/$1');
$r->post('posts', 'posts/create');
$r->put('posts/(:any)', 'posts/update/$1');
$r->delete('posts/(:any)', 'posts/delete/$1');

```

You can also define a singular resource with `resource`.

Nesting Routes
--------------

[](#nesting-routes)

Pigeon also makes it very easy to nest routes inside other routes:

```
$r->route('posts/(:num)', 'posts#show', function($r){
	$r->route('comments', 'comments#show');
});

```

The above is equivalent to:

```
$route['posts/(:num)'] = 'posts/show/$1';
$route['posts/(:num)/comments'] = 'comments/show/$1';

```

The nesting engine is clever enough to account for parameters in the URL and any further params in nested URLs, which feels very similar to the usual way we write our routes in CI:

```
$r->route('posts/(:num)', 'posts#show', function($r){
	$r->route('files/(:num)', 'files#show');
});

```

This will grab the post ID from the post URL and pass it through:

```
$route['posts/(:num)'] = 'posts/show/$1';
$route['posts/(:num)/files/(:num)'] = 'files/show/$1/$2';

```

Unit Tests
----------

[](#unit-tests)

Install [PHPUnit](https://github.com/sebastianbergmann/phpunit). I'm running version 3.6.10.

Then, simply run the `phpunit` command on the test file:

```
$ phpunit tests/Pigeon_test.php

```

Changelog
---------

[](#changelog)

**Version 0.2.0**

- Adjusted the resource routing to route to *create\_new* rather than *new*
- Replaced `(:any)` in resource routing with `([a-zA-Z0-9\-_]+)`

**Version 0.1.0**

- Initial Release

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4975d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/616bb0b51a1193358ed550722f3a22cc32217bad7b9fa7f18cab73fb0760413d?d=identicon)[jamierumbelow](/maintainers/jamierumbelow)

---

Top Contributors

[![jamierumbelow](https://avatars.githubusercontent.com/u/49284?v=4)](https://github.com/jamierumbelow "jamierumbelow (32 commits)")[![donnykurnia](https://avatars.githubusercontent.com/u/95402?v=4)](https://github.com/donnykurnia "donnykurnia (1 commits)")

---

Tags

restroutescodeigniterrouting

### Embed Badge

![Health badge](/badges/jamierumbelow-pigeon/health.svg)

```
[![Health](https://phpackages.com/badges/jamierumbelow-pigeon/health.svg)](https://phpackages.com/packages/jamierumbelow-pigeon)
```

###  Alternatives

[upstatement/routes

Manage rewrites and routes in WordPress with this dead-simple plugin

2072.5M6](/packages/upstatement-routes)[aplus/routing

Aplus Framework Routing Library

2491.6M3](/packages/aplus-routing)[contributte/api-router

RESTful Router for your Apis in Nette Framework - created either directly or via attributes

20802.8k3](/packages/contributte-api-router)[handcraftedinthealps/rest-routing-bundle

This bundle provides automatic route registration for the Controllers

582.0M2](/packages/handcraftedinthealps-rest-routing-bundle)[ezralazuardy/heimdall

Painless OAuth 2.0 Server for CodeIgniter 4

454.2k](/packages/ezralazuardy-heimdall)[causal/routing

Service to route HTTP/REST requests to your own controller/actions.

1919.9k](/packages/causal-routing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
