Skip to content

Commit 075f9c5

Browse files
tflightmnapoli
authored andcommitted
Allow setCacheFile method on router, Alias Slim's Router (#15)
* Alias Slim's Router, allow setCacheFile method Add an alias so that Slim\Router => 'router' so you can type hint the Router in a controller. Pass any settings for for routerCacheFile to the setCacheFile method to enable FastRoute’s cache. * Update minimum Slim requirements to 3.4.0 Allows routerCacheFile
1 parent 1d188d1 commit 075f9c5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"php": "~5.5|~7.0",
1818
"php-di/php-di": "^5.2.0",
1919
"php-di/invoker": "^1.2.0",
20-
"slim/slim": "^3.2.1"
20+
"slim/slim": "^3.4.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "~4.8"

src/config.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
],
3636

3737
// Default Slim services
38-
'router' => DI\object(Slim\Router::class),
38+
'router' => DI\object(Slim\Router::class)
39+
->method('setCacheFile', DI\get('settings.routerCacheFile')),
40+
Slim\Router::class => DI\get('router'),
3941
'errorHandler' => DI\object(Slim\Handlers\Error::class)
4042
->constructor(DI\get('settings.displayErrorDetails')),
4143
'phpErrorHandler' => DI\object(Slim\Handlers\PhpError::class)

0 commit comments

Comments
 (0)