Horde/Routes tackles an interesting problem that comes up frequently in web development: how do you map a URL to your code?

There are many solutions to this problem ranging from using the URL paths as an object publishing hierarchy to regular expression matching. Horde/Routes goes a slightly different way.

Using Horde/Routes, you specify parts of the URL path and how to match them to your Controllers and Actions. The specific web framework you're using may actually call them by slightly different names, but for the sake of consistency we will use these names.

Horde/Routes lets you have multiple ways to get to the same Controller and Action, and uses an intelligent lookup mechanism to try and guarantee you the URL with the least cruft* when generating the URL.

URL Cruft
Shorthand reference to what will occur if a Route can't handle all the arguments we want to send it. Those arguments become HTTP query args (/something ?query=arg&another=arg), which we try to avoid when generating a URL.

Python Version

Horde/Routes, and even this website, are directly derived from the Routes project for Python, by Ben Bangert.