1

I looked at the CakePHP 4 docs and noticed, that the support for named parameters via Router::parseNamedParams is removed.

I have an application where I make heavy use of named parameters and any other way would definitely make everything much more complicated.

Is there a practical way to use named params in Cake 4 or am I out of luck and have to stay at 3.x?

boindil
  • 95
  • 1
  • 9
  • 1
    Nothing stopping you from writing your own bit of middleware based on the 3.x implementation. Just to be clear, though, you're talking about urls like `https://example.com/things/thing:5/option:yes/page:6`? – Greg Schmidt Feb 09 '20 at 02:55
  • @GregSchmidt Those are from 2.x, in 3.x they also dont exist anymore for a reason. They are not HTTP compliant. – mark Feb 10 '20 at 17:16
  • Good point. But if someone has tons of old links out there, they might want to support them for a while to prevent 404ing their visitors. – Greg Schmidt Feb 10 '20 at 19:20
  • @GregSchmidt yup, I'm talking about these. In Cake 4 these are not supported anymore. I dont need them for any public sites, but for a pretty big API I am using and the effort to implement all the stuff in a different way currently makes no sense - especially since nothing of this is for public use. Maybe you can point me in the right direction (Cake Docs?) of how to implement a middleware for this? – boindil Feb 11 '20 at 20:54
  • 1
    https://book.cakephp.org/3/en/controllers/middleware.html#creating-middleware – Greg Schmidt Feb 11 '20 at 22:15

0 Answers0