-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig.php
49 lines (42 loc) · 1.51 KB
/
config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
use Bramus\Monolog\Formatter\ColoredLineFormatter;
use Compwright\PhpSession\Config as SessionConfig;
use Compwright\PhpSession\Handlers\Psr16Handler as SessionSaveHandler;
use Kodus\Cache\FileCache;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Psr\Log\LoggerInterface;
return [
LoggerInterface::class => DI\factory(function () {
$logger = new Logger('access');
$logHandler = new StreamHandler('php://stdout');
$logHandler->setFormatter(new ColoredLineFormatter());
$logger->pushHandler($logHandler);
return $logger;
}),
SessionConfig::class => DI\factory(function () {
$config = (new SessionConfig())
->setRegenerateIdInterval(180)
->setCookieLifetime(3600)
->setCookiePath('/')
->setCookieSecure(false)
->setCookieHttpOnly(true)
->setCookieSameSite('strict')
->setCacheLimiter('nocache')
->setGcProbability(1)
->setGcDivisor(1)
->setGcMaxLifetime(7200)
->setSidLength(48)
->setSidBitsPerCharacter(5)
->setLazyWrite(true);
$config->setSavePath(sys_get_temp_dir() . DIRECTORY_SEPARATOR . $config->getName());
$config->setSaveHandler(
new SessionSaveHandler($config, new FileCache(
$config->getSavePath() ?? sys_get_temp_dir(),
$config->getGcMaxLifetime()
))
);
return $config;
})
];