Skip to end of metadata
Go to start of metadata
You are viewing an old version of this page. View the current version. Compare with Current  |   View Page History

Zend_Controller_Router 2.0 RoadMap

Refactoring of Zend_Controller_Router_Rewrite

Goal

The current layout of the router and it's routes is not very flexible and was not made for the problems it currently tries to solve. Thus, it is going under refactoring to solve the drawbacks. In general, the following topics should be covered with the new router:

  • Lightweight: Should be as fast or if possible even faster than the current implementation
  • Design by contract: The router and it's routes get covered by interfaces
  • The router should completly work with the request object instead of URL-strings
  • Fixing bugs which are hard to fix without a BC-break

Routes

Routes are something which are independent to the rewrite router, and thus can be interfaced completly for this purpose:

  • The getInstance() method will be removed from all routes. Instead we will use a unified constructor
  • getDefault() and getDefaults() will become interface methods
  • The match() method will only allow an instance of Zend\Controller\Request\Http

Building routes via config

The router will allow to not only give complete class names for the route types, but also just the actual route name (module, regex, chain, etc.). This allows for much less typing-work. The router will also accept arrays as configuration now instead of just Zend_Config instances (see unified constructors).

Chaining

The currently known chaining will be dropped in favor of tree-matching. This will be setup similar to route chaining, but allow to match a segment in the tree only once, which will lead to better performance. For instance the router will only have to check for the hostname only once, instead of the current approach matching it for every single route again and again.

Hostname route

The hostname route will get an additional parameter, which will allow to enforce https connections. If activated, the route will only match when the connections comes via HTTPS, and assembling will prefix https:// instead of http://.

Caching support

The new rewrite router system will also come with caching support. This will be supported by creating a unique key out of the HTTP request object and storing the matched result. By doing this, a specific route will only have to be matched once. This allows future matching of the same route without iterating through all defined routes.

Interfaces

  • Zend\Controller\Router\RouterInterface
  • Zend\Controller\Router\Rewrite\RouteInterface

Abstract

  • Zend\Controller\Router\RouterAbstract

Classes

  • Zend\Controller\Router\Rewrite\Router
  • Zend\Controller\Router\Rewrite\Route\Module
  • Zend\Controller\Router\Rewrite\Route\Standard (or any other suggestions?)
  • Zend\Controller\Router\Rewrite\Route\Chain
  • Zend\Controller\Router\Rewrite\Route\Regex

CS-Cleanup

Currently the router doesn't follow the coding standard completly, this will be solved together with the refactoring.

Prototype

There is also a protoype unter development. Currently there's not much to see, but it will evolve in the near future:

http://framework.zend.com/svn/framework/standard/branches/user/dasprid/Zend_Controller_Router-2.0/

Open JIRA Issues

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.