Skip to content

Commit eab817d

Browse files
committed
Issue #490: Enabled FastRoute caching
Signed-off-by: alexmerlin <[email protected]>
1 parent 987ee49 commit eab817d

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

config/autoload/debug.global.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
/**
4+
* This is a helper file that can be required by other config files to determine the debug status.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
$path = getcwd() . '/config/development.config.php';
10+
if (! file_exists($path)) {
11+
return [
12+
'_debug' => false,
13+
];
14+
}
15+
16+
$config = require $path;
17+
return [
18+
'_debug' => $config['debug'] ?? false,
19+
];

config/autoload/routes.global.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
$debug = require getcwd() . '/config/autoload/debug.global.php';
6+
7+
return [
8+
'router' => [
9+
'fastroute' => [
10+
Mezzio\Router\FastRouteRouter::CONFIG_CACHE_ENABLED => $debug['_debug'],
11+
],
12+
],
13+
];
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
!.gitignore
2-
cache
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)