Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for RouteCollector configuration #62

Open
boesing opened this issue Feb 20, 2024 · 1 comment
Open

Missing documentation for RouteCollector configuration #62

boesing opened this issue Feb 20, 2024 · 1 comment

Comments

@boesing
Copy link
Member

boesing commented Feb 20, 2024

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] ];

if (! isset($config[RouteCollector::class])) {
return true;
}
$collectorOptions = $config[RouteCollector::class] ?? [];
if (! is_array($collectorOptions) || ! isset($collectorOptions['detect_duplicates'])) {
return true;
}
return (bool) $collectorOptions['detect_duplicates'];

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.

  1. Its a concrete implementation and not the interface
  2. it does not align with other router specific config keys such as fastroute route cache (which is router.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

@gsteel
Copy link
Member

gsteel commented Jul 18, 2024

Added docs issue over at mezzio/mezzio#183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants