Configuring the Jet platform
This is the basic configuration of the entire platform. So, for example, directory structures, URLs and a whole bunch of other things.
The configuration consists of a set of primitive classes containing static properties and corresponding methods for getting values (getter) and setting them (setter).
And why is this method chosen? I originally used the classic way via defining a large number of constants. But that turned out to be unfortunate. For one thing, it's relatively uncluttered. Next, the necessity to define those constants always - that is, to have a script with a definition of the amount of constants you have to define whether they are relevant or not. That wasn't the right thing to do. Also, the simple fact that a constant is a constant and thus in principle no longer immutable proved to be limiting and actually made some things impossible to implement.
None of these problems apply to the present solution.
The current solution has default values by default and it is not always necessary to set everything. You only set what you need to set, or what must be set (for example, directory paths).
The configuration is also clearly divided into thematic units - according to a clearly defined system and order.
For example, configuration is done as follows:
SysConf_Jet_Debug::setDevelMode( true );
SysConf_Jet_Debug::setProfilerEnabled( true );
SysConf_Jet_PackageCreator_CSS::setEnabled( false );
SysConf_Jet_PackageCreator_JavaScript::setEnabled( false );
SysConf_Jet_MVC::setCacheEnabled( false );
SysConf_Jet_Autoloader::setCacheEnabled( false );
SysConf_Jet_Translator::setAutoAppendUnknownPhrase( true );
List of configuration classes
Class | Assignment |
---|---|
SysConf_Jet_* | Basic platform configuration in the form of a set of classes. For example, it enables/disables developer mode, CSS and JS packagers, character set, timezone, system cache, and a host of other things. |
SysConf_Path | Sets the paths to all system directories. This is a mandatory setting that the application must perform. |
SysConf_URI | Sets URIs to CSS, JS, images, and the base (root) URI. This is a mandatory setting that the application must perform. |
How to set up the system
In basic application setup, the setup is done in these scripts
Class | Configuration Script |
---|---|
SysConf_Jet_* | ~/application/config/Jet.php |
SysConf_Path | ~/application/config/Path.php |
SysConf_URI | ~/application/config/URI.php |
You can of course script within these scripts at will. For example, turn on developer mode only for a certain IP address, or similarly turn on profiler.