flightphp / core

An extensible micro-framework for PHP
https://docs.flightphp.com
MIT License
2.63k stars 409 forks source link

Naming routes - help for navigation #502

Closed krmu closed 8 months ago

krmu commented 9 months ago

Hello!

We recently resolved an issue, but now I'm facing trouble with navigation. Although I've set up all the routes, manually coding URLs in the navigation is becoming cumbersome. Whenever there's a URL change, I have to go through the entire codebase to update the hardcoded URLs.

I'm not sure if this is related to issue #487. My suggestion is to create a function like: Flight::getRoute('user_dashboard'); This function would return the full path of the specified route. If the route has parameters, we could use it like this: Flight::getRoute('user_dashboard', ["param1" => 1234]);

Ideas?

magikstm commented 9 months ago

What do you mean by: "I have to go through the entire codebase to update the hardcoded URLs"

Could you possibly share one of your recent change that was "cumbersome"?

n0nag0n commented 9 months ago

I know what you're talking about. I added this to the project list cause I feel this is important as well. https://github.com/orgs/flightphp/projects/1/views/1?pane=issue&itemId=49025073

n0nag0n commented 8 months ago

https://github.com/flightphp/core/pull/510 Feedback helpful :)

krmu commented 8 months ago

Fixed in the last release 3.0.2.