I try to make my own Response class using twig
<?php
namespace app\library;
class Response
{
public function __construct($temp, $data)
{
$loader = new Twig_Loader_Filesystem('app/views');
$twig = new Twig_Environment($loader);
print $twig->render($temp, $data);
}
}
But when I try to use it
use app\library\Response;
error_reporting(E_ALL);
require_once "vendor/autoload.php";
$arr = array('name'=>'Bob', 'surname'=>'Dow', 'gender'=>'male','age'=>'25');
new Response('temp.php', $arr);
It gives me
Fatal error: Class 'app\library\Twig_Loader_Filesystem' not found in /var/www/PHP/app/library/Response.php on line 12
Where the mistake?