Fatal error: Class 'Slim\Views' not found in ...vendor\slim\views\Twig.php -


i'm building simple website in php slim framework , twig template engine.

i've installed slim , twig composer in command line.

this index.php

<?php require __dir__ . '/vendor/autoload.php'; date_default_timezone_set('europe/copenhagen');  $app = new slim\app( array (     'view' => new slim\views\twig() ));   $view = $app->view(); $view->parseroptions = array(     'debug' => true );  $view->parserextensions = array(     new \slim\views\twig(), );  $app->get('/', function() use($app){     $app->render('about.twig'); });  $app->get('/contact', function() use($app){     $app->render('contact.twig'); });  $app->run();  ?> 

the error message is:

fatal error: class 'slim\views' not found in c:\program files (x86)\easyphp-devserver-14.1vc11\data\localweb\projects\simple-php-website\vendor\slim\views\twig.php on line 46

it works without twig framework. guess trouble on loading twig. i've tried different variations of line:

'view' => new slim\views\twig()

but confuses me is, error message referring line 46 in twig.php - in core of slim.

i've tried reinstalling twig , slim several times.

any suggestions wrong?

much appreciated!

edit composer.json

{ "name": "tyf5vl/simple-php-website", "authors": [     {         "name": "my name",         "email": "my@mail.com"     } ], "require": {     "monolog/monolog": "^1.17",     "slim/slim": "^3.1",     "twig/twig": "^1.23",     "slim/views": "^0.1.3" } } 

http://www.slimframework.com/docs/features/templates.html states view -> composer require slim/twig-view should have final file

{     "require": {         "slim/slim": "^3.5",         "slim/twig-view": "^2.1"     } } 

Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -