Bug: Replace dynamic route name resolution with hardcoded route names to ensure predictable route registration behavior in Laravel >= 12.29.0.#457
Open
abhihyder wants to merge 1 commit intoKyon147:masterfrom
Conversation
… to ensure predictable route registration behavior in Laravel >= 12.29.0.
Contributor
Author
|
@Kyon147 it's very important change. Check this as early as possible. |
Owner
|
Hi @abhihyder thanks for the PR - great write up. I think it is worth us also adding an update to the wiki as well for this. I'll also read up on the changes, and see what our options are long term. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
The Laravel framework team merged [PR #56920](laravel/framework#56920) which changes route‐name precedence: the first registered route wins. In Laravel v12.29.0, since packages often register routes before the application’s
RouteServiceProvider, package routes now take precedence over application-defined routes with the same name.This PR updates the package configuration comments to:
🔍 Why This Change Is Needed
Because of the change introduced in Laravel framework PR #56920, route name collisions now behave differently. Previously, application routes might override package routes. But now, if a package route is registered first, it wins. That change has caused unexpected routing in applications using this package.
By updating the documentation and configuration comments:
🧪 Impact
There are no breaking changes in this PR. The runtime behavior remains the same. The change is purely documentation- and configuration-based, enhancing clarity and developer experience.
✅ Example Scenario
An application defines the same callback route name as the package (e.g.,
authenticate.token). Because of Laravel PR #56920, if the package route was registered first, the application route is ignored.By customizing the route name via environment variable:
Then defining that route in the application, the application route will now take precedence.
📌 Notes
This update is compatible with all supported Laravel versions and addresses the new routing precedence behavior introduced in Laravel 12.29.0 via PR #56920.