Application Configurations
Application configurations are used to specify the global behavior of an application. They include specification of path aliases, namespace usages, module and service configurations, and parameters.
Configuration for an application is stored in an XML file named application.xml, which should be located under the application base path. Its format is shown in the following,
- The outermost element <application> corresponds to the TApplication instance. The PropertyName="PropertyValue" pairs specify the initial values for the properties of TApplication.
- The <paths> element contains the definition of path aliases and the PHP inclusion paths for the application. Each path alias is specified via an <alias> whose path attribute takes an absolute path or a path relative to the directory containing the application configuration file. The <using> element specifies a particular path (in terms of namespace) to be appended to the PHP include paths when the application runs. PRADO defines two default aliases: System and Application. The former refers to the PRADO framework root directory, and the latter refers to the directory containing the application configuration file.
- The <modules> element contains the configurations for a list of modules. Each module is specified by a <module> element. Each module is uniquely identified by the id attribute and is of type class. The PropertyName="PropertyValue" pairs specify the initial values for the properties of the module.
- The <services> element is similar to the <modules> element. It mainly specifies the services provided by the application.
- The <parameters> element contains a list of application-level parameters that are accessible from anywhere in the application. You may specify component-typed parameters like specifying modules, or you may specify string-typed parameters which take a simpler format as follows,
Note, if the value attribute is not specified, the whole parameter XML node (of type TXmlElement) will be returned as the parameter value.
By default without explicit configuration, a PRADO application when running will load a few core modules, such as THttpRequest, THttpResponse, etc. It will also provide the TPageService as a default service. Configuration and usage of these modules and services are covered in individual sections of this tutorial. Note, if your application takes default settings for these modules and service, you do not need to provide an application configuration. However, if these modules or services are not sufficient, or you want to change their behavior by configuring their property values, you will need an application configuration.