PHP code example of damess / expressive-session-middleware

1. Go to this page and download the library: Download damess/expressive-session-middleware library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

damess / expressive-session-middleware example snippets


return [
    'middleware_pipeline' => [
        'always' => [
            'middleware' => [
                DaMess\Http\SessionMiddleware::class,
            ],
            'priority' => 10000,
        ],
    ],
];

/**
 * @param ServerRequestInterface $request
 * @param ResponseInterface $response
 * @return ResponseInterface
 */
public function __invoke(ServerRequestInterface $request, ResponseInterface $response)
{
    /**
     * @var \Aura\Session\Session $session
     */
    $session = $request->getAttribute(\DaMess\Http\SessionMiddleware::KEY);
}

return [
    'session' => [
        'name'     => 'PHPSESSID',
        'lifetime' => 7200,
        'path'     => null,
        'domain'   => null,
        'secure'   => false,
        'httponly' => true,
    ],
];