diff options
author | Daniel Weipert <code@drogueronin.de> | 2022-01-10 20:29:04 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2022-01-10 20:29:04 +0100 |
commit | a319f3a419790925bed539ba141038c72a83e70f (patch) | |
tree | dfb24183cc693863df733e190dbbc6da93bb82e5 /src/Template.php |
Initial commit
Diffstat (limited to 'src/Template.php')
-rw-r--r-- | src/Template.php | 23 |
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); + } +} + |