SlimFramework + PHP-View

0

I downloaded the Php-View library to use with the Slim Framework 3. x, but I'm not able to do the view return.

// Get container
$container = $app->getContainer();

// Register component on container
$container['view'] = function ($container) {
  return new \Slim\Views\PhpRenderer('App/resources/views');
};

$app->get('/', function($request, $response) {
  $tes = new \App\Teste(); // Usando Eloquent ORM
  $tes->nome = "OI";
  return $this->view->render($response, "home.php", array("obj" => $tes->nome));
});
$app->run();

If I make a var_dump($tes) , I get the object normally, but if I try to call the view I only get the error

  

A website error has occurred. Sorry for the temporary inconvenience.

    
asked by anonymous 22.07.2016 / 21:05

1 answer

0

I found the error;

The same was in the statement of path for files

return new \Slim\Views\PhpRenderer('App/resources/views');

One last bar was missing / after views .

return new \Slim\Views\PhpRenderer('App/resources/views/');
    
22.07.2016 / 21:53