This is simple Express/Connect middleware that loads PHP sessions in an express request.
$ npm install php-session-middleware --save
app.use(require('php-session-middleware')({
handler: 'file',
opts: {
path: '/tmp/'
}
}));
app.get('/restricted', function(req, res) {
if (req.session) {
res.render('hello', {
name: req.session.name
});
}
});
- Optionally parse
php.ini
for configuration - Allow for other session handlers, such as memcached
- More tests
- This is the initial release, with minimal testing. Use at your own risk.