Good content takes time and effort to come up with.

Please consider supporting us by just disabling your AD BLOCKER and reloading this page again.







Increase Session Timeout In Laravel | StackCoder


Increase Session Timeout In Laravel


04th October 2020 1 min read
Share On     Share On WhatsApp     Share On LinkedIn


In this article, I will show you how to increase the session timeout in Laravel.


NOTE: Laravel session timeouts are set in minutes


We will be covering the following topics


  1. Session Settings In .env File
  2. Settings In config/settings.php File

Session Settings In .env File


Increase the session timeout for 1 year.


.env Settings

SESSION_LIFETIME=525600


Calculation for 1 year (365 days)

365 days * 24 hours * 60 minutes = 525600 minutes

Settings In config/session.php File


You can even directly edit lifetime in the session config settings as shown below.


As you see by default it will read from the .env file. If you by chance delete the SESSION_LIFETIME in .env file then it will add 43200 minutes.


<?php

use Illuminate\Support\Str;

return [
    .......

    'lifetime' => env('SESSION_LIFETIME', 43200),
    
    .......
];

Conclusion


Hope you got to know how to increase the session timeout in Laravel. Don't forget to share with your friends.







Author Image
AUTHOR

Channaveer Hakari

I am a full-stack developer working at WifiDabba India Pvt Ltd. I started this blog so that I can share my knowledge and enhance my skills with constant learning.

Never stop learning. If you stop learning, you stop growing