Paul Okeke
Paul Okeke

Reputation: 1414

How to Set Session or Cookie Life Time in Laravel Lumen

How do I set Cookie/Session life-time in Lumen. In laravel this can be found in the app/config/session.php but since Lumen uses .env file for its configuration, how do I set the life time of sessions? Also when I put a value in a session, Session::put($key,$value) it doesn't last for more than 3 requests, the value becomes lost, could this be due to it's life-time or something else?

just in case, this is what my .env file looks like:

APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomKey!!!

APP_LOCALE=en
APP_FALLBACK_LOCALE=en

DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=

CACHE_DRIVER=cookie
SESSION_DRIVER=cookie
QUEUE_DRIVER=database

Upvotes: 3

Views: 6233

Answers (2)

Ali Al-Estarbadee
Ali Al-Estarbadee

Reputation: 546

it is simple

just go to app/config/session.php and set 'lifetime' => 0

Upvotes: 0

Margus Pala
Margus Pala

Reputation: 8663

You can set it with SESSION_LIFETIME=60

More options for session config can be found from here https://github.com/laravel/lumen-framework/blob/5.0/config/session.php

Upvotes: 6

Related Questions