PHPackages                             josegonzalez/cakephp-page-route - 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. josegonzalez/cakephp-page-route

ActiveCakephp-plugin[Framework](/categories/framework)

josegonzalez/cakephp-page-route
===============================

Automagically route /:page style routes without any fuss in CakePHP

19172PHP

Since Nov 29Pushed 10y ago3 watchersCompare

[ Source](https://github.com/josegonzalez/cakephp-page-route)[ Packagist](https://packagist.org/packages/josegonzalez/cakephp-page-route)[ RSS](/packages/josegonzalez-cakephp-page-route/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/00081f78d2d580ee8acadb82cfe56c27b58b38f9d63c3b55269eb2bdb0c918c4/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f7365676f6e7a616c657a2f63616b657068702d706167652d726f7574652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/josegonzalez/cakephp-page-route)[![Coverage Status](https://camo.githubusercontent.com/74a3baa41b08fb3cef2f891db2d4c32db28ed6076fd2b3189f8b45cda08d5df6/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6a6f7365676f6e7a616c657a2f63616b657068702d706167652d726f7574652e7376673f7374796c653d666c61742d737175617265)](https://coveralls.io/r/josegonzalez/cakephp-page-route?branch=master)[![Total Downloads](https://camo.githubusercontent.com/da4a45a817af852752f3939204740c2e61d9d53c55ba2967b11e6aac2301d6e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f7365676f6e7a616c657a2f63616b657068702d706167652d726f7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-page-route)[![Latest Stable Version](https://camo.githubusercontent.com/632f0530df26c38daa7098cce7f33ad762b5f2c57e56e9aacec237c02cea8ffb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f7365676f6e7a616c657a2f63616b657068702d706167652d726f7574652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/josegonzalez/cakephp-page-route)[![Documentation Status](https://camo.githubusercontent.com/3a1b1e5a7676b180471d6b3cb6d88173c08689badf8d679f2917e006dfaa0e46/68747470733a2f2f72656164746865646f63732e6f72672f70726f6a656374732f63616b657068702d706167652d726f7574652f62616467652f3f76657273696f6e3d6c6174657374267374796c653d666c61742d737175617265)](https://readthedocs.org/projects/cakephp-page-route/?badge=latest)[![Gratipay](https://camo.githubusercontent.com/40a48c7b3fc02e9d39dd715fe09e404c4cb2e89288c6ace0773d2aab6913b46f/68747470733a2f2f696d672e736869656c64732e696f2f67726174697061792f6a6f7365676f6e7a616c657a2e7376673f7374796c653d666c61742d737175617265)](https://gratipay.com/~josegonzalez/)

PageRoute Plugin
================

[](#pageroute-plugin)

Forget about cluttering your `routes.php` with zillions of `/page`-style routes.

Background
----------

[](#background)

Someone in IRC was migrating tons of static pages into a fresh CakePHP install. In the webroot. I told him to move them into `app/View/Pages` and use routes to properly route everything. I also mentioned that rather than routing every static file one by one, it might be possible using a custom `CakeRoute` class, but didn't elaborate.

So a few minutes of hacking later, and here I am with this lovely `PageRoute`.

Requirements
------------

[](#requirements)

- PHP 5.2+
- CakePHP 2.x

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

[](#installation)

*\[Using [Composer](http://getcomposer.org/)\]*

Add the plugin to your project's `composer.json` - something like this:

```
{
	"require": {
		"josegonzalez/cakephp-page-route": "1.0.0"
	}
}

```

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/Plugins` directory, rather than in the usual vendors file. It is recommended that you add `/Plugins/PageRoute` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

*\[Manual\]*

- Download this:
- Unzip that download.
- Copy the resulting folder to `app/Plugin`
- Rename the folder you just copied to `PageRoute`

*\[GIT Submodule\]*

In your app directory type:

```
git submodule add git://github.com/josegonzalez/cakephp-page-route.git Plugin/PageRoute
git submodule init
git submodule update

```

*\[GIT Clone\]*

In your plugin directory type

```
git clone git://github.com/josegonzalez/cakephp-page-route.git PageRoute

```

### Enable plugin

[](#enable-plugin)

In 2.0 you need to enable the plugin your `app/Config/bootstrap.php` file:

```
	CakePlugin::load('PageRoute');

```

If you are already using `CakePlugin::loadAll();`, then this is not necessary.

Usage
-----

[](#usage)

Way near the bottom of your `app/Config/routes.php` file, add the following:

```
