- Notifications
You must be signed in to change notification settings - Fork11.4k
[13.x] Add route removal functionality to RouteCollection#56055
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Conversation
Hi! I noticed the PR was marked as draft. Just wanted to check if there’s anything specific I should address or improve, or if I should wait until the master branch’s tests are green before continuing. I’ve looked into the test failures and they seem unrelated to my changes, but I’m happy to dig deeper if needed. |
The alternative way is to fork the package and remove the unnecessary routes. |
Thank you for your input—forking the package is definitely an option and, in some situations, it may be the only way to customize things deeply. However, I’d argue that forking introduces quite a bit of extra complexity and maintenance overhead, especially for minor changes like tweaking or removing a route. |
This PR adds a
remove()
method to theRouteCollection
andCompiledRouteCollection
classes, enabling the removal of previously defined routes. This is particularly useful for overriding or removing routes defined by third-party packages.Context
I had several cases where package-defined routes interfered with my application's use case or needed modification (changing middleware, etc.) without removing the package itself. This change enables such removal/overriding of routes defined by third-party packages.
Note
This is a breaking change as it adds a new method to the
RouteCollectionInterface
. I'm targeting the master branch but am open to targeting the 12.x branch if preferred.Further Discussion
Is there interest in extending this functionality to make it easier to modify existing routes (e.g., changing middleware)? One idea would be to add functionality to define a new route and remove the existing one in a single operation.