Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

getnathan's avatar

Session and Cookie management in Laravel

Hi guys We are looking good set of information on Session and Cookie management in Laravel 4. Understand that SessionServiceProvider and CookieServiceProvider are set in app.php and Session.php is used to set the session specific parameters. http://laravel.com/docs/4.2/session says Laravel is configured to use the file session driver by default. But just wonder if you know of any comprehensive resources specific to this topic. Thanks

0 likes
4 replies
getnathan's avatar

I guess file driver gives us the advantages over

  • low latency
  • security and
  • file size (as user's machine has only 4kb)

But still if we are talking about an application that has a potential to get high number of users do you think it is a good option. I mean the file capacity of session folder at the server end can grow exponentially.

getnathan's avatar

OIC... there is a garbage collection in laravel and session files created by Laravel get cleaned up automatically. But i still like to weigh your thoughts on this.. please contribute.

willvincent's avatar

I think you'd have to have a pretty terrible hosting solution in place to be concerned about running out of storage space from session files.. :)

If you are planning to support very high user capacity, then you're also likely to need to scale horizontally (multiple web heads, etc) If that's the case, something like a redis or memcache server that will maintain sessions across all web heads would be wise. But really, until you get beyond one web server, anything other than file or database session storage is probably not really worth time worrying about.

Please or to participate in this conversation.