Symfony: FOS User Bundle, check if user is logged in

If you are using the “FOSUserBundle” in Symfony, here is how you can check if a user is logged in:

if ( $this->get(‘security.context’)->isGranted(‘ROLE_USER’)) {
//User is logged in

if( $this->container->get(‘security.context’)->isGranted(‘IS_AUTHENTICATED_FULLY’) ){
// authenticated (NON anonymous)

For more information about user authentication in Symfony, visit the Friends of Symfony website at:

If you are an organization in the Jacksonville Northeast Florida area looking for open source PHP web developers with experience in Symfony, Drupal, WordPress, Magento, or API integration experts, please contact me.  I have a list of competent web developers who I can recommend here in Jacksonville, Southwest Florida, and throughout the US, Canada, UK, Australia, and Germany as temporary web development consultants or remote web developers!

About Author:

Senior Cloud Software Engineer and 25+ years experienced video production, video editing and 3D animation services for a variety of global clients including local video production here in Jacksonville, Florida.

Leave a Comment

Your email address will not be published. Required fields are marked *