<commit_before># Slim Secure Session Middleware
Secure session middleware for [Slim 3 framework](http://www.slimframework.com/).
- longer and more secure session id's
- session data encryption
- set session cookie path, domain and secure values automatically
- extend session lifetime after each user activity
- helper class to handle session values easily with namespaces and dot notation ([Dot - PHP dot notation array access](https://github.com/adbario/php-dot-notation))

**If you're on shared host and use sessions for storing sensitive data, it's a good idea to store session files in your custom location and encrypt them.**

## Installation

Via composer:

    composer require adbario/slim-secure-session-middleware

## Configuration
Create an array of session settings in you application settings. Default settings for session:

    $settings = [
        'session' => [
            // Session cookie settings
            'name'           => 'slim_session',
            'lifetime'       => 1440,
            'path'           => '/',
            'domain'         => null,
            'secure'         => false,
            'httponly'       => true,
    
            // Set session cookie path, domain and secure automatically
            'cookie_autoset' => true,
    
            // Path where session files are stored, PHP's default path will be used if set null
            'save_path'      => null,
    
            // Session cache limiter
            'cache_limiter'  => 'nocache',<commit_msg>Changed lifetime from seconds to minutes<commit_after># Slim Secure Session Middleware
Secure session middleware for [Slim 3 framework](http://www.slimframework.com/).
- longer and more secure session id's
- session data encryption
- set session cookie path, domain and secure values automatically
- extend session lifetime after each user activity
- helper class to handle session values easily with namespaces and dot notation ([Dot - PHP dot notation array access](https://github.com/adbario/php-dot-notation))

**If you're on shared host and use sessions for storing sensitive data, it's a good idea to store session files in your custom location and encrypt them.**

## Installation

Via composer:

    composer require adbario/slim-secure-session-middleware

## Configuration
Create an array of session settings in you application settings. **Please note that session lifetime is defined in minutes.** Default settings for session:

    $settings = [
        'session' => [
            // Session cookie settings
            'name'           => 'slim_session',
            'lifetime'       => 24,
            'path'           => '/',
            'domain'         => null,
            'secure'         => false,
            'httponly'       => true,
    
            // Set session cookie path, domain and secure automatically
            'cookie_autoset' => true,
    
            // Path where session files are stored, PHP's default path will be used if set null
            'save_path'      => null,
    
            // Session cache limiter
            'cache_limiter'  => 'nocache',
{'fraction_non_alphanumeric': 0.08354838709677419, 'fraction_numerical': 0.0025806451612903226, 'mean_word_length': 2.3344086021505377, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4896903', 'n_tokens_mistral': 763, 'n_tokens_neox': 741, 'n_words': 315}