The request object is a simple value object that is passed between
Zend_Controller_Front and the router, dispatcher, and
controller classes. It packages the names of the requested module,
controller, action, and optional parameters, as well as the rest of
the request environment, be it HTTP, the CLI, or
The module name is accessed by
The controller name is accessed by
The name of the action to call within that controller is accessed by
Parameters to be accessible by the action are an associative array of key and value pairs that are retrieved by
getParams()and set with
setParams(), or individually by
Based on the type of request, there may be more methods available.
The default request used,
for instance, has methods for retrieving the request URI, path
The request object is passed to the front controller, or if none is provided, it is instantiated at the beginning of the dispatch process, before routing occurs. It is passed through to every object in the dispatch chain.
Additionally, the request object is particularly useful in testing. The developer may craft the request environment, including module, controller, action, parameters, URI, etc, and pass the request object to the front controller to test application flow. When paired with the response object, elaborate and precise unit testing of MVC applications becomes possible.