diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-16 02:48:50 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-05-16 02:48:50 +0300 |
| commit | b49941608a8d37ca6bedf2529a703876530124d4 (patch) | |
| tree | ecdef8a36a36f495fe996606729bb1db3023d156 /public/app/config/bootstrap.php | |
| parent | 59cd40235bf4746a119421609b25d7e9b7f65f83 (diff) | |
| download | gyraf1gov-b49941608a8d37ca6bedf2529a703876530124d4.tar.gz gyraf1gov-b49941608a8d37ca6bedf2529a703876530124d4.tar.bz2 gyraf1gov-b49941608a8d37ca6bedf2529a703876530124d4.zip | |
anom refactoring; remove noisy depricated files
Diffstat (limited to 'public/app/config/bootstrap.php')
| -rw-r--r-- | public/app/config/bootstrap.php | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/public/app/config/bootstrap.php b/public/app/config/bootstrap.php new file mode 100644 index 0000000..a51272e --- /dev/null +++ b/public/app/config/bootstrap.php @@ -0,0 +1,62 @@ +<?php + +/** initialize System + * ----------------------------------------------------------------------------- + * + * Finalalize the MVC framework and construct the central objects + * (Registry and Request) + * + * Include _anything_ that is common practice on the request life-cycle + * of your project and does not need to be shown in the /public/index.php + * Usualy here you shall initialize supplamentary services like Sessions + * / Database / Caching etc. + * + * NOTE: + * Always try to keep the app as light as possible, so load only what is + * critical for the MVC to operate; + * anything else can be injected on-demand + * + * ----------------------------------------------------------------------------- + */ + +// setup error-handliing +// ----------------------------------------------------------------------------- +require_once APP_ROOT.'/core/helpers/error_handling.php'; + + + +// Setup Application Engiine +// ----------------------------------------------------------------------------- +// Setup supplementary services (derectry or as promises/vows) +// Session, Database, Caching + + +// Attache database to the Regostry a vow +Registry::vow('database', function() { return new Database(); }); + + +// Attach Cache to the Resitry as a vow +// (CACHE_DRIVER) acts as driver-wrapper +// --- -- -- - - - +Registry::vow('cache', function() { return new (CACHE_DRIVER)(); }); +// CHECK: if strict mode has any benefits: +// Registry::vow('cache', function():Cache_interface { return new (CACHE_DRIVER)(); }); + + +// Initialize THE REQUEST +// ----------------------------------------------------------------------------- +Registry::set('REQUEST', new Request()); + + + +// load design-patterns +// (these patterns use some of the project's central objects (Registry, +// Cache, Database), so laod them after. +// ----------------------------------------------------------------------------- +require_once APP_ROOT.'/core/helpers/design_patterns.php'; + + +// Add Routes +// ----------------------------------------------------------------------------- + +require_once WEB_ROOT.'/app/config/init_routes.php'; // initialize routes |
