=============================== Execution Environment =============================== -------------- Starting Solar -------------- The [[Solar::start()]] method starts the Solar environment; it is usually the very first method call you make after including the Solar.php file in your bootstrap script. It loads the configuration values, cleans up $GLOBALS, and so on. {{code: php require_once 'Solar.php'; Solar::start('/path/to/config/Solar.config.php'); // the rest of your script Solar::stop(); }} The start() method performs a number of activities for you to set up the execution environment: 1. Reads the [config_file][config_file] into [Solar_Config::$_store][]. 2. Processes the `Solar_Config::$_store['Solar']['ini_set']` key/value pairs using [[php::ini_set() | ]]. 3. Registers a [[Solar_Locale::Overview | 'locale']] object to handle localization strings, and a [[Solar_Request::Overview | 'request']] object to represent the request environment (especially superglobal values). Uses the [[Solar_Registry::Overview | Solar_Registry]] class for this. 4. Finally, Solar runs any scripts noted in `Solar_Config::$_store['Solar']['start']`. This allows you to specify additional environment startup behaviors. The [Solar_Config::$_store][] array stores the values read in from Solar.config.php, also known as the [config_file][config_file]. You can not access the $_store property directly; instead, read from it using [Solar_Config::get()][]. [Solar_Config::get()]: http://solarphp.com/class/Solar_Config/get() [Solar_Config::$_store]: http://solarphp.com/class/Solar_Config/Properties#_store [config_file]: http://solarphp.org/manual:solar:config_file -------------- Stopping Solar -------------- As a counterpart to [[Solar::start()]], the [[Solar::stop()]] method shuts down the Solar environment. {{code: php require_once 'Solar.php'; Solar::start('/path/to/config/Solar.config.php'); // the rest of the script goes here Solar::stop(); }} Effectively, all this does it execute any scripts named in Solar_Config::$_store['Solar']['stop']. This allows you to run shutdown scripts particular to your system. ------------------------------ Config Keys ------------------------------ You can configure the Solar class using these keys. | key | value | -------------- | --------------------------------------------------------------- | `ini_set` | *(array)* [[php::ini_set() | ]] parameters | `start` | *(array)* custom startup scripts | `stop` | *(array)* custom shutdown scripts | `locale_class` | *(string)* the class to use for locales, default `Solar_Locale` ini_set --------- These config key values get called as part of the [[Solar::start()]] process. For example, if you have this in [Solar_Config::$_store][] ... {{code: php $config['Solar']['ini_set']['display_errors'] = true; }} ... [[Solar::start()]] will issue `ini_set('display_errors', true)` as part of the startup process. start ------- These values represent scripts to execute as part of [[Solar::start()]]. For example, if you have this in [Solar_Config::$_store][] ... {{code: php $config['Solar']['start'][] = '/path/to/start1.php'; $config['Solar']['start'][] = '/path/to/start2.php'; }} ... then [[Solar::start()]] will run `start1.php` and `start2.php` as part of its startup process. stop ------ These values represent scripts to execute as part of [[Solar::stop()]]. For example, if you have this in [Solar_Config::$_store][] ... {{code: php $config['Solar']['stop'][] = '/path/to/stop1.php'; $config['Solar']['stop'][] = '/path/to/stop2.php'; }} ... then [[Solar::stop()]] will run `stop1.php` and `stop2.php` as part of its shutdown process.