lionware / symfony-session-timeout
Invalidate Symfony sessions based on inactivity for a certain period of time
Installs: 36 796
Dependents: 0
Suggesters: 0
Security: 0
Stars: 16
Watchers: 1
Forks: 4
Open Issues: 1
pkg:composer/lionware/symfony-session-timeout
Requires
- php: >=5.3.9
- symfony/framework-bundle: ~2.0|~3.0|~4.0
This package is not auto-updated.
Last update: 2025-12-14 14:02:35 UTC
README
Invalidate Symfony sessions based on inactivity for a certain period of time.
This does not make use of garbage collection as suggested in http://symfony.com/doc/current/components/http_foundation/session_configuration.html#session-idle-time-keep-alive. This method is more accurate and does not depend on garbage collection parameters to function well.
Installation
Add SymfonySessionTimeout in your composer.json
{
"require": {
"lionware/symfony-session-timeout": "*"
}
}
Register the bundle in your app/AppKernel.php:
public function registerBundles() { $bundles = array( // ... new Lionware\SymfonySessionTimeoutBundle\LionwareSymfonySessionTimeoutBundle() ); )
Add the parameter in app/config/parameters.yml and set the value to your preferred expiration time (which is set to an hour in this example).
parameters: lionware_session_expiration_time: 3600
Add the configuration in app/config/config.yml
lionware_symfony_session_timeout: session: expiration_time: "%lionware_session_expiration_time%"
Notes
Cookie expiration
Expiration of the cookie also means expiration of the session, therefore it is wise to set it to a relatively high value or 0 (valid for the length of the browser session).
# app/config/config.yml framework: session: cookie_lifetime: 0