History

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)

  1. set up some basic defines / ini settings
  2. load zenmagick\base\ClassLoader from either lib/base/base.phar or lib/base
  3. Set up base class loader for lib/base and lib/vendor
  4. DEPRECATED: Configure ZMLoader for lib/core and lib/mvc
  5. Set up application class loader for apps/APP_NAME/lib
  6. 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
  7. Load main application config file apps/APP_NAME/config/config.yaml
  8. Register all listeners as confgured via the setting 'zenmagick.base.events.listeners'
  9. Load settings from zenmagick/global.yaml
  10. Set up locale as per 'zenmagick.core.locales.locale'
  11. Set up timezone as per 'zenmagick.core.date.timezone' or the default timezone
  12. Register Logging system as error/exception handler if enabled by setting 'zenmagick.base.logging.handleErrors'
  13. Fire bootstrap_done event
  14. 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

Also available in: HTML TXT