mrsuh/nginx-session-handler

Nginx session handler

Installs: 2 859

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

Type:symfony-bundle

3.0.0 2023-05-02 15:45 UTC

This package is auto-updated.

Last update: 2024-10-31 00:18:44 UTC


README

Latest Stable Version Total Downloads License

This bundle integrates predis and snc/redis-bundle into your Symfony 3/4 application So, you need to configure the bundles too.

Installation

Add the nginx-session-handler package to your require section in the composer.json file.

composer require mrsuh/nginx-session-handler:2.*

Add the NginxSessionHandlerBundle to your application's kernel (Symfony 3):

<?php
public function registerBundles()
{
    $bundles = array(
        // ...
        new Mrsuh\NginxSessionHandlerBundle\MrsuhNginxSessionHandlerBundle(),
        // ...
    );
    ...
}

Configure the session in your config.yml:

framework:
    session:
        handler_id:  mrsuh.session_handler

mrsuh_nginx_session_handler:
    session_lifetime: 3600
    session_prefix: phpsession

Add session.lua script to your nginx.conf

location /security {
    content_by_lua_file session.lua;
}

Now your php session locate in redis. Your location /security allow for authenticated users with role ROLE_ADMIN only.