PHP code example of geekjob / expressjs-php-session-handler
1. Go to this page and download the library: Download geekjob/expressjs-php-session-handler 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/ */
geekjob / expressjs-php-session-handler example snippets
\GeekJOB\ExpressjsSessionHandler::register(
name : 'sid',
secret: 'secret key',
cookie: [
'domain' => '.your.domain', // Share cookie through sub domains
'path' => '/',
'maxage' => strtotime('+1hour')-time(), // Set maxage
],
store : [
'handler' => 'redis',
'path' => 'tcp://127.0.0.1:6379',
'prefix' => 'session:',
'ttl' => 3600 // 60 min
],
secure: false // Set to true if signature verification is needed.
);
\GeekJOB\ExpressjsSessionHandler::register(
[
'name' => 'sid',
'secret' => 'secret key',
'cookie' => [
'domain' => '.your.domain', // Share cookie through sub domains
'path' => '/',
'maxage' => strtotime('+1hour')-time(), // Set maxage
],
'store' => [
'handler' => 'redis',
'path' => 'tcp://127.0.0.1:6379',
'prefix' => 'session:',
'ttl' => 3600 // 60 min
],
'secure' => false // Set to true if signature verification is needed.
]
);
\GeekJOB\ExpressjsSessionHandler::register(
secret: 'secret key',
cookie: [
'domain' => '.your.domain', // Share cookie through sub domains
'path' => '/',
]
);
dockerfile
FROM php:fpm
...
RUN pecl install redis && docker-php-ext-enable redis
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.