STDOUT MVC API: Handling Requests Into Responses

This high-performance API elegantly and efficiently translates client (page/resource) requests into server responses using a dialect of MVC paradigm.

How does it work?

This API, like any other web MVC API, implements Model-View-Controller pattern. API logic is bootstrapped by a FrontController class. FrontController's job is to translate client page request (read from PHP superglobals) into a HTTP response based on contents of user-defined xml file where your application is set up. Instead of implementing translation logic itself, it delegates to components dedicated to a particular aspect of this process. These components are of two types:

All classes inside API belong to namespace Lucinda\MVC\STDOUT! User defined components need not (and should not) use that namespace.

What are the steps taken to issue response to request?

The order in which FrontController performs its operations is:

  1. Constructs Application object based on xml file.
  2. Uses ListenerLocator to locate then instances and runs user-defined ApplicationListener classes in the order they were set in <listeners> tag.
  3. Constructs Request object based on client request information collected by PHP superglobals.
  4. Runs API-defined PageValidator to match contents of Request with Application objects and detect requested: page, path parameters, content type.
  5. Uses ListenerLocator to locate then instances and runs user-defined RequestListener classes in the order they were set in <listeners> tag.
  6. Constructs Response object based on Application and Request information.
  7. Uses ControllerLocator to locate then instances and runs user-defined Controller class that matches requested page based on Application, Request and Response objects.
  8. If response hasn't been disabled via disable() method @ Response:
  9. Displays response back to caller by running commit() method @ Response object

How can I install and use it?

To learn how to install and use this API, follow this step-by-step guide!


Share