aaronbieber/breeze — Issue #2: Pull routes out of the server config into the framework itself.
Author: aaronbieber
Created: 2012-01-22 21:22:03+00:00
State: open

Rails, for instance, asserts its routes in an actual ruby code file using some built-in functions. The way we handle routes right now is serviceable, but requires editing the `.htaccess` file for any change.

For Apache-based installs, it is unlikely that we can escape the necessity of mod_rewrite. However, my thought is that we can write a single rule that simply captures the whole request path into a variable and rewrites to `index.php`, which could then search user-defined routes at the application level.

We would want the ability to something like:

$routes->connect('user/edit/$id',
array('controller' => 'user',
'action' => 'edit')
);

And have the "id" segment captured into a variable named "id" when the action is called. It seems like this could be done without a huge amount of trouble by using `split()` to pull the path apart.

Maybe when the routes are digested at runtime, an internal tree of path parts is built, then each request has its path split up and the tree is walked for matches.