summaryrefslogtreecommitdiff
path: root/include/autoload.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/autoload.php')
-rw-r--r--include/autoload.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/autoload.php b/include/autoload.php
new file mode 100644
index 0000000..de80241
--- /dev/null
+++ b/include/autoload.php
@@ -0,0 +1,16 @@
+<?php
+ spl_autoload_register(function($class) {
+
+ $root_dir = dirname(__DIR__); // we were in include/
+
+ // - internal classes are loaded from classes/ and use special naming logic instead of namespaces
+
+ $class_file = "$root_dir/classes/" . str_replace("_", "/", strtolower($class)) . ".php";
+
+ if (file_exists($class_file))
+ include $class_file;
+
+ });
+
+ // also pull composer autoloader
+ require_once "vendor/autoload.php";