diff --git a/public_html/api-dispatch.php b/public_html/api-dispatch.php
index 41da5375..dc7066b0 100644
--- a/public_html/api-dispatch.php
+++ b/public_html/api-dispatch.php
@@ -5,9 +5,5 @@ define('DS', DIRECTORY_SEPARATOR);
require_once(__DIR__ . DS . '..' . DS . 'vendor' . DS . 'autoload.php');
require_once(__DIR__ . DS . '..' . DS . 'src' . DS . 'AutoLoader.php');
-$builder = new \DI\ContainerBuilder();
-$builder->setDefinitionCache(new Doctrine\Common\Cache\ArrayCache());
-$builder->addDefinitions(__DIR__ . DS . '..' . DS . 'src' . DS . 'di.php');
-$container = $builder->build();
-$dispatcher = $container->get('Szurubooru\Dispatcher');
+$dispatcher = \Szurubooru\Injector::get(\Szurubooru\Dispatcher::class);
$dispatcher->run();
diff --git a/src/Injector.php b/src/Injector.php
new file mode 100644
index 00000000..d6a41483
--- /dev/null
+++ b/src/Injector.php
@@ -0,0 +1,22 @@
+setDefinitionCache(new \Doctrine\Common\Cache\ArrayCache());
+ $builder->addDefinitions(__DIR__ . DS . '..' . DS . 'src' . DS . 'di.php');
+ self::$container = $builder->build();
+ }
+
+ public static function get($className)
+ {
+ return self::$container->get($className);
+ }
+}
+
+Injector::init();