I've been trying out Lumen (a micro PHP Framework based on Laravel 5) for a few hours and I'm not able to add Middlewares to my project which basically means that I'm not able to use Features like Sessions or CSRF Protection.
My .env looks like this:
APP_ENV=local
APP_DEBUG=true
APP_KEY=some32charslongkey
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=somedbname
DB_USERNAME=someusername
DB_PASSWORD=somepw
QUEUE_DRIVER=database
CACHE_DRIVER=memcached
SESSION_DRIVER=memcached
and my bootstrap/app.php like this:
require_once __DIR__.'/../vendor/autoload.php';
Dotenv::load(__DIR__.'/../');
$app = new Laravel\Lumen\Application(
realpath(__DIR__.'/../')
);
$app->withFacades();
$app->withEloquent();
$app->singleton(
'Illuminate\Contracts\Debug\ExceptionHandler',
'App\Exceptions\Handler'
);
$app->singleton(
'Illuminate\Contracts\Console\Kernel',
'App\Console\Kernel'
);
$app->middleware([
// 'Illuminate\Cookie\Middleware\EncryptCookies',
// 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
// 'Illuminate\Session\Middleware\StartSession',
// 'Illuminate\View\Middleware\ShareErrorsFromSession',
// 'Laravel\Lumen\Http\Middleware\VerifyCsrfToken',
]);
require __DIR__.'/../app/Http/routes.php';
return $app;
As soon as I uncomment the lines within $app->middleware([ ... ]); the app doesn't show anything on any of the routes. I'm new to configuration with .env and maybe I just forgot to add something but I can't seem to solve this problem.