Bootstrap
Bootstrap means the initial code that is required to set up the environment in which to run the actual application.
Conventions/Assumptions
- Bootstrap is the process of making all code available for execution; this should not really include actual code being run except for:
- Loading config files
- In addition, the bootstrap code is application agnostic - so no request processing, etc.
- The bootstrap code will not explicitly load code (ie functions). All code required during bootstrap is loaded on demand by the ClassLoader.
bootstrap order (as of 0.9.12)
- set up some basic defines / ini settings
- load
zenmagick\base\ClassLoaderfrom either lib/base/base.phar or lib/base - Set up base class loader for lib/base and lib/vendor
- DEPRECATED: Configure
ZMLoaderfor lib/core and lib/mvc - Set up application class loader for apps/APP_NAME/lib
- Set up lib class loader for all locations listed in
ZM_LIBS- this is a comma separated list of directories relative to the zenmagick folder - Load main application config file apps/APP_NAME/config/config.yaml
- Register all listeners as confgured via the setting
'zenmagick.base.events.listeners' - Load settings from zenmagick/global.yaml
- Set up locale as per
'zenmagick.core.locales.locale' - Set up timezone as per
'zenmagick.core.date.timezone'or the default timezone - Register
Loggingsystem as error/exception handler if enabled by setting'zenmagick.base.logging.handleErrors' - Fire
bootstrap_doneevent - Init plugins
In addition to the explicitly listed ZMLoader init (DEPRECATED), ZMLoader is currently also configured in all places ClassLoader is used.
Once all code is moved into k
namespaces, this will be removed.
What about the other config files, etc?
All other init code, incl. application code is done in additional event listeners listening to the bootstrap_done event.
For both admin and storefront the first ones are:
zenmagick\apps\store\StoreEventListener
This is right now mostly to cover all the thnigs that got removed from bootstrap.php:- load all config files in shared/store/config
- set up additional plugin locations
- load legacy static code (previously loaded via
ZMLoader::loadStatic()) - add (legacy) support for zenmagick/local.php
zenmagick\http\BootstrapListener
Loads all http related config files, like url mappings, sacs mappings, etc
| Read and Edit and Edit Permissions: | Martin Rademacher |