You are browsing the Symfony 4 documentation, which changes significantly from Symfony 3.x. If your app doesn't use Symfony 4 yet, browse the Symfony 3.4 documentation.
Symfony provides a nice session object that you can use to store information about the user between requests.
To see how to use the session, read Managing the Session.
More about Sessions¶
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.