jenssegers / laravel-mongodb-session

A MongoDB session driver for Laravel
77 stars 27 forks source link

Does not work with Laravel 5 #14

Closed MightyPork closed 4 years ago

MightyPork commented 8 years ago

however it crashes whenever the driver is selected - some incompatibility with the Symfony session driver.

Error is thrown in Symfony\Component\HttpFoundation\Session\Storage\Handler\MongoDbSessionHandler on line 73.

dschreck commented 8 years ago

In Laravel 5 set your env value to: SESSION_DRIVER=database

and in config/session.php

'connection' => 'mongodb',

And the MongoDB driver will store values to the DB.

MightyPork commented 8 years ago

@dschreck thanks, but that in fact doesn't work

omanizer commented 8 years ago

I'm currently using this with Laravel 5.2 and it has worked fine until I upgraded the PHP driver.

Are you using the new MongoDB driver rather than PHP's old Mongo drive by chance? I noticed that MongoDbSessionHandler.php is depending on the old Mongo driver.

I modified this file and got it to work again. See this gist:

https://gist.github.com/omanizer/fd3d2693dfd8e79e2244d47ef8b3f808

I'd like to get this implemented into this library so that it will work with the new driver.

omanizer commented 7 years ago

FYI, this ended up being that symfony's MongoDbSessionHandler wasn't itself compatible with the new MongoDb PHP driver at the time. My gist above is no longer necessary when using a later version of Symfony.

thche commented 5 years ago

In Laravel 5 set your env value to: SESSION_DRIVER=database

and in config/session.php

'connection' => 'mongodb',

And the MongoDB driver will store values to the DB.

correction:

Add in .env following lines: SESSION_DRIVER=database SESSION_CONNECTION=mongodb

MightyPork commented 4 years ago

got it working, four years later. thanks, @thche lol