Throughout our site we have a login button, whenever someone logs in the button changes into “log out” and the users name is displayed next to it. Our server setup uses Varnish so we devised a way where a bit of javascript does a POST and we check if the user is Authenticated.
To avoid server overhead I thought it would be simple to just create a script that sits in the website root /checkuser.php and try and read the session variables there (we let Varnish not cache this file). This way we can bypass all the classes that need to be loaded just to check this users session.
However, long story short, the sessions in checkuser.php are always empty. If I check with $user->getAttribute it works. Now what?
Okay, I got it. Symfony uses its sessions under its own name. If you want to use sessions from outside your app (or framework) you can get the sessions like so:
Provided of course that you didn’t rename the session name in factories.yml
thx prodigitalson for the help.