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

Router service name should be configurable #69

Open
gsteel opened this issue Sep 19, 2024 · 4 comments
Open

Router service name should be configurable #69

gsteel opened this issue Sep 19, 2024 · 4 comments
Labels
Enhancement New feature or request

Comments

@gsteel
Copy link
Member

gsteel commented Sep 19, 2024

If the router service name was configurable, we wouldn't have to re-implement this factory when the router you want to use is not aliased to RouterInterface::class

$router = $container->get(RouterInterface::class);

@gsteel gsteel added the Enhancement New feature or request label Sep 19, 2024
@boesing
Copy link
Member

boesing commented Sep 19, 2024

WHY would the router not properly aliased to the interface? if that is the case, the application would not pick that router up for routing either and thus would not match?

thats the whole point of how routing works in mezzio:

https://github.com/mezzio/mezzio-router/blob/4.0.x/src/RouteCollectorFactory.php

Everything basically uses that service aliased to the interface, so the cors component should do that as well.

I would suggest to streamline those projects you have issues with rather than adding workarounds in components.

@gsteel
Copy link
Member Author

gsteel commented Sep 19, 2024

We have existing form for this:

https://github.com/mezzio/mezzio-helpers/blob/5.17.x/src/UrlHelperFactory.php

In my case, I have 2 applications running out of the same code-base, each with a different router instance in the container along with a different set of routes.

@boesing
Copy link
Member

boesing commented Sep 19, 2024

Interesting. I'd rather ensure having proper configuration when bootstrapping but as there is already this kind of magic, go ahead. 🤷🏼‍♂️

@gsteel
Copy link
Member Author

gsteel commented Sep 19, 2024

I don't think I'd call it magic though - it's just configuration for "what service id gives me a router?", defaulting to the accepted norm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants