Modules

A module is an instance of a class implementing the IModule interface. A module is commonly designed to provide specific functionality that may be plugged into a PRADO application and shared by all components in the application.

PRADO uses configurations to specify whether to load a module, load what kind of modules, and how to initialize the loaded modules. Developers may replace the core modules with their own implementations via application configuration, or they may write new modules to provide additional functionalities. For example, a module may be developed to provide common database logic for one or several pages. For more details, please see the configurations.

There are three core modules that are loaded by default whenever an application runs. They are request module, response module, and error handler module. In addition, session module is loaded when it is used in the application. PRADO provides default implementation for all these modules. Custom modules may be configured or developed to override or supplement these core modules.

Request Module

Request module represents provides storage and access scheme for user request sent via HTTP. User request data comes from several sources, including URL, post data, session data, cookie data, etc. These data can all be accessed via the request module. By default, PRADO uses THttpRequest as request module. The request module can be accessed via the Request property of application and controls.

Response Module

Response module implements the mechanism for sending output to client users. Response module may be configured to control how output are cached on the client side. It may also be used to send cookies back to the client side. By default, PRADO uses THttpResponse as response module. The response module can be accessed via the Response property of application and controls.

Session Module

Session module encapsulates the functionalities related with user session handling. Session module is automatically loaded when an application uses session. By default, PRADO uses THttpSession as session module, which is a simple wrapper of the session functions provided by PHP. The session module can be accessed via the Session property of application and controls.

Error Handler Module

Error handler module is used to capture and process all error conditions in an application. PRADO uses TErrorHandler as error handler module. It captures all PHP warnings, notices and exceptions, and displays in an appropriate form to end-users. The error handler module can be accessed via the ErrorHandler property of the application instance.

Custom Modules

PRADO is released with a few more modules besides the core ones. They include caching modules (TDbCache and TMemCache), user management module (TUserManager), authentication and authorization module (TAuthManager), etc.

When TPageService is requested, it also loads modules specific for page service, including asset manager (TAssetManager), template manager (TTemplateManager), theme/skin manager (TThemeManager).

Custom modules and core modules are all configurable via configurations.