Way to Change Default Session Lifetime in Laravel

Hello Artisan,

In this laravel 8 session lifetime tutorial, I will explain how to set session lifetime or how to increase session lifetime in laravel. This article goes in detail on how to increase session timeout in laravel. We will learn how to set session lifetime in laravel.

I wanna show you how to set session timeout in laravel. I am here to help you to give an example of laravel increased session timeout. You can easily increase session lifetime in laravel in many ways. But I am going to share one of them. 

If you want to increase your session lifetime then you can easily do it from the configuration file in laravel. laravel provide session.php there is a lifetime a key option for setting time in minutes. Using that key we have to increase our session application session lifetime.

you can simply define value in minutes in your env file as below:



//525600 means 60 * 24 * 365 = 525600



use Illuminate\Support\Str;
return [
    'lifetime' => env('SESSION_LIFETIME', 120),


Read also: Laravel Cookie Example | Set and Get Cookie in Laravel


Hope it can help you.


Facebook Github
A web enthusiastic, a self-motivated full-stack software engineer from Dhaka, Bangladesh with experience in developing applications using Laravel , React and Vue js