How to Increase Session Timeout Limit in Laravel 7?

Today, I will show you how to increase session timeout in laravel 7.  You will learn you set session lifetime in laravel 7.  We will avail you to give an example of laravel 7 increase session timeout. 
 
if you increase session juncture in laravel 7 then you can use bellow two solutions.  Two solutions in first solution in utilizing. env file and second solution in config file used. 
 
you can simply use increased session lifetime in laravel. 
 
rudimentally, you can not set a lifetime session for aeonian but you can set in minutes for session expiration juncture.  so I will set 1-year juncture for session expire

60 * 24 * 365 = 525600

Here i will show how to increase lifetime from env file and configuration file. so let's see both example as bellow:

Example 1 : .env File

You can easy to define value in minutes in your env file as bellow.

.env

SESSION_LIFETIME=525600

then after open your config/session.php and change the following into it.

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

Example 2: Using Config File

config/session.php

use Illuminate\Support\Str;
  
return [
  
    .....
  
    'lifetime' => 1 * (60 * 24 * 365),
  
    .....
  
]

i hope you like this small article.

Tags: