Get online users and set rules

dev-master 2018-05-03 15:12 UTC




SessionBundle Toolbar View

This bundle allows you to obtain all users connected to the system. In the same way it allows to define if the multi-session and the multi-user in the same is allowed.

Latest Stable Version Total Downloads Dependency Status Symfony License travis


Step 1: Download the Bundle

$ composer require kronhyx/session-bundle

This command requires that you have global composer installed, as explained in composer's documentation.

Step 2: Activate the Bundle

// app/AppKernel.php

// ...
class AppKernel extends Kernel
    public function registerBundles()
        $bundles = array(
            // ...
            new \Kronhyx\SessionBundle\KronhyxSessionBundle()

    // ...

Step 3: Load the bundle routes

# app/config/routing.yml
    resource: "@KronhyxSessionBundle/Resources/config/routing.yml"    
    prefix:   /
# ...

Step 4: Add the bundle configuration

# app/config/config.yml
    provider: AppBundle\Entity\UserEntity
    firewall: 'main'
    collector: true
        ajax: 5
        idle: 15
        multi_session: true
        multi_user: true
        - ROLE_SUPER_ADMIN        
# ...


  • provider (required): Represents the user provider entity that implement UserInterface
  • firewall: (default: main) Defines the name of the FIREWALL to which the security.yml rules belong
  • collector: (default: true) Defines whether to show the collector in the debug bar in _profiler
  • time.ajax: (default: 5)Time in seconds it takes to perform the next query that returns active sessions
  • time.idle: (default: 15)Time in seconds to define if a user is disconnected from the system
  • allow.multi_user: (default: true) Defines whether a user is allowed to have multiple active sessions on the same IP
  • allow.multi_session: (default: true) Defines whether a user is allowed to log in multiple times at the same time
  • roles.superadmin: (default: [ROLE_SUPER_ADMIN]) Defines which roles can end an active session

Step 5: Add a handler in the security.yml

# app/config/security.yml
# ...
    # ...
        # ...
            handlers: [ Kronhyx\SessionBundle\Event\Listener\KernelListener ]
        # ...
    # ...

Step 6: Update Entities

$ php bin/console doctrine:schema:update --force 


You can read all the documentation and functionalities of this bundle to make better use of this. !The documentation for this bundle is available in the Resources/doc directory of the bundle


SessionBundle is a bundle for symfony framework, as it has been developed this has contributed a series of users that list here.

Security Issues

If you discover a vulnerability, a bug or have some idea to improve to propose that it leads to a better performance of this bundle, please contact us or leave your concerns here


Copyright (c) 2017. See LICENSE for details.