TestApp/Application.php
<?php
namespace TestApp;
class Application extends \Silex\Application {
public function __construct( ) {
parent::__construct( );
$this->register( new \Silex\Provider\TwigServiceProvider( ), array( 'twig.path' => array( __DIR__ . '/Templates' ), ) );
$this->mount( '', new Controller\Provider\HomeControllerProvider( ) );
}
}
TestApp/Controller/HomeController.php
<?php
namespace TestApp\Controller;
use TestApp\Application;
class HomeController {
public function index( Application $app ) {
return $app[ 'twig' ]->render( 'index.twig', array( ) );
}
}