This package is abandoned and no longer maintained. No replacement package was suggested.

Adds a session expiry listener

Installs: 1 764

Dependents: 0

Suggesters: 0

Stars: 2

Watchers: 11

Forks: 3

Open Issues: 0


1.1.1 2013-04-20 10:12 UTC


Adds a listener that expires user sessions after a configurable period of inactivity.


Add this require reference to your composer.json:

php composer.phar require tui/session-bundle:~1.1

Add the Bundle to your app/AppKernel.php:

public function registerBundles()
    $bundles = array(
        new Tui/SessionBundle/TuiSessionBundle(),

You can configure the timeout in your app.yml file:

    session_timeout: 3600 # One hour

Redirecting on expiry

By default when the session expires, the listener will invalidate the session and throw a CredentialsExpired exception. Obviously it'd be much better to redirect the user to a "Login expired" page. There are two ways you can do that:

Redirect to a route

The listener can redirect to a given route when the session expires. This is super easy, but not very flexible. In your app.yml file:

    redirect_route: login_expired

Return a custom response

Alternatively you can create a custom response, register it as a service and configure it to be returned instead. Here's a trivial example that uses the built-in response class.

    expired_response: session_expired

        class: Symfony\Component\HttpFoundation\Response
            - 'Your login expired, sorry!'