I am working with a new Lumen installation (creating a web API), most things work, but when I try to use a router to specify a class, I get this error:
Fatal error: Class 'App\Http\Controllers\Controller' not found in /Applications/MAMP/htdocs/moments/lumen/app/Http/Controllers/MomentController.php on line 5
This is my router in /Http/routes.php
$app->get('/', ' MomentController@index ');
And this is my class in the application /Http/Controllers/MomentController.php
<?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; class MomentController extends Controller { public function index() { echo 123; } }
I activated these components in bootstrap / app.php :
$app->withFacades();$app->withEloquent();Dotenv::load(__DIR__.'/../');
This is my composer.json file:
{ "name": "laravel/lumen", "description": "The Laravel Lumen Framework.", "keywords": ["framework", "laravel", "lumen"], "license": "MIT", "type": "project", "require": { "laravel/lumen-framework": "5.1.*", "vlucas/phpdotenv": "~1.0" }, "require-dev": { "phpunit/phpunit": "~4.0", "fzaninotto/faker": "~1.0" }, "autoload": { "psr-4": { "App\\": "app/" }, "classmap": [ "database/" ] }, "autoload-dev": { "classmap": [ "tests/" ] }, "config": { "preferred-install": "dist" } }
I think this has something to do with the namespace, but I can't figure it out. Any clues?
THX