The following Implementation proposal was written by Jose Maria Sala <jmsala>
Implementation proposal
The workflow of the application should start with the creation of an object that will act as a resource pool, and also will initialize the necessary classes and load required config parameters. This main object will only call the Controller class, be able to throw exceptions and simulate an autoload (similar to what java does) for the classes that are not registered.
The Controller class.
This class will receive requests from the main container. This class can be customized by extending it and/or overriding its methods. The main function of this class is to call the bussiness logic of the Action class. The Controller class will work as a bridge between the requests and the logic we want to execute. It will select an Action class, instantiate it and invoke a method.
The Action class.
This class must be programmed in thread-safe way, because it is possible that the Controller uses the same instance of the Action class for simultaneous requests. To achieve this, instance and static variables should not store information related to the state of a particular request. They might be used to share global resources across requests for the same action. Access to other resources might be synchronized if those resources require protection.
Application structure.
The default application structure should contain the following structure:
action -> Business logic
authentication -> Security related interfaces
controller -> Application controller
core -> Base classes, exceptions,...
database -> DB abstraction layer
html -> Templates, css,...
utils -> Support classes and utilities
validators -> XML validators, regexp,...
Additionally to the Smarty based html rendering, we could consider using XML data streams and XSLT to build the pages, to skip a parsing process, or use a caching system to increase overall performance and speed when rendering templates.
New modules can be easily developed and integrated into the flow of the application just creating a new controller and action class, and implementing the existing interfaces. I find very interesting the use of interfaces in php5, because that will give us more control of the flow of the data, and the code structure aswell. Also making use of the existing authentication, error management, database objects, due to have everything controlled by a common entry point that will be the main resources object is expected. We could also provide some coding guidelines and classes templates.