summaryrefslogtreecommitdiff
path: root/core/config/init.php
diff options
context:
space:
mode:
authorGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
committerGeorge Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-04-27 03:47:30 +0300
commit059e0d95d0c28bc5060e87e146eaf7411f51bf90 (patch)
tree7c21ac432f16dde2329a0d5954d70711eceb48e6 /core/config/init.php
parent26cd8ee99659ef1926c96a049c93645ffc9b169d (diff)
downloadgyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.gz
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.tar.bz2
gyraf1gov-059e0d95d0c28bc5060e87e146eaf7411f51bf90.zip
skeleton commit; based on an anom project
Diffstat (limited to 'core/config/init.php')
-rw-r--r--core/config/init.php64
1 files changed, 64 insertions, 0 deletions
diff --git a/core/config/init.php b/core/config/init.php
new file mode 100644
index 0000000..589a486
--- /dev/null
+++ b/core/config/init.php
@@ -0,0 +1,64 @@
+<?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 '../core/helpers/error_handling.php';
+
+
+// depricated:
+/// // Load rendering sub-system
+/// // -----------------------------------------------------------------------------
+/// require_once RENDERING_SYSTEM;
+
+
+// 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 '../core/helpers/design_patterns.php';
+
+
+// Add Routes
+// -----------------------------------------------------------------------------
+
+require_once 'app/config/init_routes.php'; // initialize routes