I'm creating a Laravel application and I'm trying to grasp the concept of the HTTP session. I noticed that I don't really understand it on a fundamental level (e.g. what exactly happens).
On the internet there isn't much information available besides some basic stuff (getting and retrieving data, plus a few other common things).
I want to better understand it, so it'd be extremely helpful is someone could clarify the following things for me:
file
vs cookie
?Many thanks in advance!
As you can see, session
is dependent on the driver
you choose, and at the same time you can select the timeout as well in config\session.php
.
In case of Cookie
, the session will expire in two cases:
(current_time - cookie_creation_time) > session_timeout
set in the session.php
.In all drivers, one thing is common: whenever you access the website, and a request is made to the server, it will add the last access time and calculate the session timeout from there.
When the user navigates from the browser and the cookie is still there and it hasn't expired, the user will be identified and session will remain the same.
I hope it's clearer... If not, let me know. I will share some examples.