summaryrefslogtreecommitdiff
path: root/src/Template.php
diff options
context:
space:
mode:
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);
+ }
+}
+