Closed delboy1978uk closed 4 years ago
I honestly don't see a good use case for this, I'd suggest that a vendor package shouldn't be forcing the router you use or setting the routes for you.
my framework is truly modular, you can install vendor packages, and by adding that package name to a config file, the framework registers all it needs to the DI container, including any endpoints the module might have. See here for an example https://github.com/delboy1978uk/bone-user/blob/master/src/BoneMvcUserPackage.php#L124-L144
what I'd suggest instead is something like service providers that are optional to use, it's not ideal to have a vendor do something that needs to be undone so I don't think we should be making that easy
Would you be cool with making $this->routes
a protected property in that case? That way your lib stays clean and I can extend it
It already is 👍
I'll close this and the PR for now, feedback on your other PR, if you want to look at that I'll get a release out tomorrow
Haha so it is! Okay great! :-P
I'm not seeing any additional feedback for the other pull requests?
For this use case, I'll suggest you create a middleware to protect some routes.
@LuanMaik I already have! ;-) Cheers
If we have routes specified in a vendor package which we would like to disable, it would be nice to be able to get the routes registered via a
getRoutes()
method, and aremoveRoute(Route $route)
method to deregister a route.As an example, imagine a "user" vendor package that has register, login, reset password etc routes, but for a particular site, you don't want people to be able to register an account, so you could remove the route.
https://github.com/thephpleague/route/pull/272