php - Silex controller not found -
i'm new user of silex framework , have little (huge me) problem registering route controller. controller can not found silex. here tree of files:
my composer.json file:
{ "require": { "silex/silex": "~1.3", "twig/twig": "^1.24", "doctrine/dbal": "~2.2" }, "autoload": { "psr-4": { "controller\\": "web/" } } }
my index.php file in web directory:
<?php // web/index.php require_once __dir__.'/../vendor/autoload.php'; use symfony\component\httpfoundation\response; use silex\provider\urlgeneratorserviceprovider; use silex\provider\validatorserviceprovider; use silex\provider\servicecontrollerserviceprovider; use silex\provider\httpfragmentserviceprovider; $app = new silex\application(); $app['debug']=true; $app->get('/','homecontroller::index'); $app->run();
and homecontroller.php file:
<?php /** * created phpstorm. * user: oskar * date: 2016-02-07 * time: 02:27 */ namespace web\controller{ use symfony\component\httpfoundation\request; use silex\application; use silex\controllercollection; class homecontroller { public function index() { return 'hello controller'; } } }
my error:
regards.
Comments
Post a Comment