This bundle provides a Doctrine session handler to save sessions in a database.
Installing this bundle can be done through these simple steps:
Add the bundle to your project as a composer dependency:
// composer.json
{
"require": {
"shapecode/doctrine-session-handler-bundle": "~1.0"
}
}
or ...
$ composer require shapecode/doctrine-session-handler-bundle:~1.0
Then do a composer update.
$ composer update
Add the bundle to your application kernel:
<?php
// application/ApplicationKernel.php
public function registerBundles()
{
// ...
$bundle = array(
// ...
new Shapecode\Bundle\Doctrine\SessionHandlerBundle\ShapecodeDoctrineSessionHandlerBundle,
);
// ...
return $bundles;
}
Update your database.
$ php bin/console doctrine:schema:update --force
Now you have to change your application config.
framework:
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
# handler_id: session.handler.native_file
handler_id: shapecode_doctrine_session_handler.handler
You are done ;)