Check if Symfony PHP session has been started
Here’s how you can check if a session in Symfony was started:
if ($this->get('session')->isStarted()){
// Session has been started, so do stuff here
}Not a big fan of session variables, but used for non-sensitive session data, I think sessions are still useful. After all, if you only want certain behaviors on your website tailored to a customer apply only while their browser is open on your site, this is an efficient way to pass certain settings and values along with a small footprint since all sessions go to garbage upon the visitor’s browser being closed.