-
-
Notifications
You must be signed in to change notification settings - Fork 0
Extend router and remove RoutingServiceProvider
#30
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also worth considering that the 1st version of the project works with older versions of Laravel, starting from 7.0.
The booting method did not exist in that version.
I see two ways of events development:
- modify your code so that it supports older versions of Laravel and release a new version as part of the 1st - 1.7.0.
- remove support for those versions of Laravel where the
bootingmethod does not exist in the service provider and leave your code. Release the new version as a major change - 2.0.0.
Based on the situation and current time, the best solution for me is the second option, so I suggest:
- update the code from the
mainbranch to your project; - detect those Laravel versions that do not have the
bootingmethod and remove them fromcomposer.json,.github/workflows/phpunit.xml; - Raise the minimum allowed version of PHP to 8.2.
RoutingServiceProvider
Sorry. I used Related Updatehttps://github.com/guanguans/laravel-route-names/blob/main/src/ServiceProvider.php#L46 protected function extendRouter(): void
{
- $this->booting(function (): void {
+ $this->app->booting(function (): void {
$this->app->extend(
'router',
static fn(
BaseRouter $router,
$app
): Router => !$router instanceof Router ? new Router($app['events'], $app) : $router
);
});
} |
…iceProvider - Remove the `RoutingServiceProvider` class to simplify the codebase and centralize routing logic. - Extend the router directly in `ServiceProvider` to ensure custom `Router` instantiation when necessary. - This change reduces redundancy and improves maintainability of the routing setup.
RoutingServiceProvider
andrey-helldar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
|
Sorry, I just found out that there is a problem with this PR. When I updated to the latest version(1.7.0), all requests returned a 404 response. I am looking into the cause... |
|
@guanguans I stopped using this project a long time ago in my applications, so I can only rely on tests. I'm currently working on removing support for older versions of Laravel (only L10+ will be supported) and will also add Workspace to make it easier to test changes. This will be available in the coming hours. I have also canceled the releases of versions 1.8.0 and 1.7.0. |
|
@guanguans Corrected a mistake. Still this service provider is needed and it should be loaded at application startup. For correct work it is necessary to replace the initialization of class Application. I have separated this notification into a more noticeable block on the README page. https://github.com/TheDragonCode/laravel-route-names/releases/tag/2.0.0 |

Hello, I really like the features of this project. However, it requires manually registering the routing service provider. This commit solves that problem.