First basic working version with twig

This commit is contained in:
Tim
2023-06-02 18:16:39 +02:00
commit 7216edd186
6 changed files with 303 additions and 0 deletions

22
src/renderer.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace Ardent\Game;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
class renderer
{
private Environment $twig;
public function __construct()
{
$loader = new FilesystemLoader('../templates');
$this->twig = new Environment($loader);
}
public function render(string $template, array $data = []): string
{
return $this->twig->render($template, $data);
}
}