mezzio-router
mezzio-router copied to clipboard
Missing documentation for `RouteCollector` configuration
Documentation
There seems to be a hidden config flag to disable the route collectors "duplication check" which can have performance improvements.
It is achieved by providing the following config via config service:
use Mezzio\Router\RouteCollector;
return [ RouteCollector::class => ['detect_duplicates' => false] ];
https://github.com/mezzio/mezzio-router/blob/09e5da5c1d7b86f0a71b765307170d2b7fae9a46/src/RouteCollectorFactory.php#L55-L65
Feature was introduced with #3 back in january 2021. Somehow, no1 requested the author to add the feature to the documentation :-(
If we start document this feature, I wonder if we should instead deprecate the RouteCollector::class config key.
- Its a concrete implementation and not the interface
- it does not align with other router specific config keys such as
fastrouteroute cache (which isrouter.fastroute)
I would recommend using router.detect_duplicates config key:
return [
'router' => ['detect_duplicates' => false],
];
We can still support RouteCollector::class for this major and drop it in v4.
Ref: #3 Ref: https://github.com/mezzio/mezzio-fastroute/blob/31d63fc0736c75b5dbd0d5c7ae9251fb70082be0/src/FastRouteRouterFactory.php#L19-L24
Added docs issue over at https://github.com/mezzio/mezzio/issues/183