Join WhatsApp ChannelJoin Now

Laravel 8 Increase Session Lifetime

Hello Dev,

Today, i we will show you laravel 8 increase session lifetime. This article will give you simple example of laravel 8 increase session lifetime. you will learn laravel 8 increase session lifetime. we will help you to give example of laravel increase session timeout.

You can easily increase session lifetime in all versions of Laravel. By the way, you can not set this a lifetime session for forever but you can set in minutes for session expiration time. so i will set 1 year time for session expire.

So let’s follow few step to create example of laravel 8 increase session lifetime.

Example 1:- Using .env File

simple define value in minutes in your env file
.env

SESSION_LIFETIME=525600

config/session.php

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

Example 2:- Using Config File

config/session.php

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

Recommended Posts