summaryrefslogtreecommitdiff
path: root/src/Template.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2022-01-10 20:29:04 +0100
committerDaniel Weipert <code@drogueronin.de>2022-01-10 20:29:04 +0100
commita319f3a419790925bed539ba141038c72a83e70f (patch)
treedfb24183cc693863df733e190dbbc6da93bb82e5 /src/Template.php
Initial commit
Diffstat (limited to 'src/Template.php')
-rw-r--r--src/Template.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Template.php b/src/Template.php
new file mode 100644
index 0000000..b4360b8
--- /dev/null
+++ b/src/Template.php
@@ -0,0 +1,23 @@
+<?php
+
+namespace Elements;
+
+use Twig\Environment;
+use Twig\Loader\FilesystemLoader;
+
+class Template
+{
+ public static ?Environment $twig = null;
+
+ public static function init(): void
+ {
+ $loader = new FilesystemLoader(dirname(__DIR__) . '/templates');
+ self::$twig = new Environment($loader);
+ }
+
+ public static function render(string $name, array $context = []): string
+ {
+ return self::$twig->render($name, $context);
+ }
+}
+