-
Notifications
You must be signed in to change notification settings - Fork 344
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
Switch away from fatfree for routing #1265
Comments
One less dependency on F3 Fixes: #1265
@jtojnar I've created a new router, https://github.com/ertuo-php/ertuo -- Are you interested to have a look ? |
@kktsvetkov Interesting concept. Unfortunately, selfoss still targets PHP 5.6 for now so we cannot use it. I hope to bump target version soon and then I will re-evaluate. Could you clarify few points?
|
@jtojnar Thanks for having a look at it!
These two are related. The keys are used to select the next child route.
Only PHP libraries. The main focus was on Fast Route and Symfony as the most popular ones.
The fallback is not really a 404, it is a default value you might want to use instead. I wanted to have the route tree configuration as simple as possible and re-using the empty key kind of makes sense as in both cases (no match or empty step) there is nothing accepted.
It is the same concept Symfony is using. At the end of the dispatching, they have an array with parameters, and some of the parameters are "reserved" as they carry the handler that should be called. The methods corresponding to HTTP verbs do indeed set some attributes. At the end of dispatching, it is just like you put it -- you get the matched handler from the result attributes and call it. |
In Symfony, you directly set $routes->add('api_post_show', '/api/posts/{id}')
->controller([BlogApiController::class, 'show'])
->requirements(['id' => '\d+'])
->methods(['GET', 'HEAD']); I understand that running the controller is not actually a goal for a routing library but I feel it would still be useful to show a simple example of that. |
Thanks, this is good feedback. The README is a struggle, as it is not my strongest part to explain how things work. I've written a couple of articles trying to get into more details:
The methods and controller thing, perhaps for the same route ( yield '' => Route::add()
->get('BlogPost::show')
->post('BlogPost::update') ... This is in the README, but obviously, it is not obvious 😎 Since a day or two ago I also added |
Slowly tearing fatfree out of the codebase.
We should probably wait for after 2.19 so that we can stuff depending on use newer PHP.
Alternatives:
See also:
The text was updated successfully, but these errors were encountered: