alexdodonov / mezon-router

Small and fast router
https://twitter.com/mezonphp
269 stars 18 forks source link

How to extract callback #4

Closed spartan closed 4 years ago

spartan commented 4 years ago

I have a few questions/suggestions:

  1. Is there a way to extract the callback only without calling it directly ? I use a custom dispatcher.
  2. Can you add OPTIONS to supported HTTP methods ? I use it as a JSON schema reader.
  3. Is there a way to reverse the routing by name ? For example:
    $router->reverse('user', ['id' => 1]); // => results to "/user/1"
  4. Thank you for nikic/fast-route benchmarks. Did not expect those :)
  5. You should also add a "complexity" flag for each of the routing systems you've tested. Many people would use Symfony router the wrong way ;)
alexdodonov commented 4 years ago

Hi!

Is there a way to extract the callback only without calling it directly ? I use a custom dispatcher.

There is no this feature right out of the box, but I shall add it soon.

Can you add OPTIONS to supported HTTP methods ? I use it as a JSON schema reader.

OK

Is there a way to reverse the routing by name ? For example:

No but I shall add this feature

Thank you for nikic/fast-route benchmarks. Did not expect those :)

You are welcome )

You should also add a "complexity" flag for each of the routing systems you've tested. Many people would use Symfony router the wrong way ;)

Could you please explain what do you mean?

alexdodonov commented 4 years ago

@spartan 1&2 are done in version 1.0.17 3th feature request will be done soon

spartan commented 4 years ago

@alexdodonov Thank you! I'm going to switch to your router soon then :)

For #5, I meant that the true performance of Symfony router can only be achieved if you really understand it properly. This is something the many developers will possible not be aware. This is what I meant with "complexity". Some routers are more error prone than others on setup. This is not the case with yours or nikic/FastRoute.

alexdodonov commented 4 years ago

@spartan I have implemented this case in version 1.0.18 $router->reverse('user', ['id' => 1]); // => results to "/user/1"

Thank you! I'm going to switch to your router soon then :) Nice! Is it open source project?

For #5, I meant that.... OK I got it. May be in the next articles I shall add it.

Is everithing OK with this tiket? Can I close it?

alexdodonov commented 4 years ago

Looks like everything OK.

@spartan Thanks for your ticket and feedback. If you will have more questions please feel free to open another issues here. Once again thanks.

spartan commented 4 years ago

Thank you! I'm going to switch to your router soon then :) Nice! Is it open source project?

Sorry for the late reply. It's open source yes - PSR compliant and opinionated micro frameowork :)

For routing there is no PSR so we came up with one and you'll be able to choose the routing "engine". Currenly we only support nikic, a nikic fork with with reverse routing and we'll add yours too as they seem to be the best overall from our experience.

alexdodonov commented 4 years ago

Thanks )

alexdodonov commented 4 years ago

@spartan could you please show repo with your framework?

spartan commented 4 years ago

We will push the first stable version towards the end of the month together with all the other packages. The repo will be pushed here: https://github.com/spartan/router.