Routing syntax variants

Which router variant is more understandable/usable for you?

  • 1
  • 2
  • Another (I’ll post about it)

0 voters

I haven’t gotten around to dig into Yii3 yet but, just curious, what does the pipe() method do?

Adding a middleware. That’s not the final name, just an example.

Which is faster?

1 Like

I would prefer the way via strings + regex like it was in yii2. That way of routing was really straightforward and easy to understand in my opinion + it was much easier to read than those two examples.
Not sure what the advantages of those 2 are

1 Like

Both are equal.

1 Like

I would say: the one with better support for older PHP versions, and better IDE debugging capabilities, if they’re both equal, then the less error prone and more readable & concise, although the first one looks more readable for me but that can be subjective so I’ll stick to the second one if that works fine, we wont need to spend devs effort/time for personal choice anyway.

1 Like

Common folks can hardly decide such a highly convention-based and overcomplexed stuff. I sincerely apologize for such an opinion, I am well aware how much efforts you guys put into it and Yii3 development over last year. It’s just too complex to take quickly some reasonable standpoint without playing with it, testing benchmarks and some real-world apps. It takes much more time than in Yii2. This question perhaps would be best decided within development team only.

2 Likes

Yeah. Maybe. We’ve just changed the syntax. For the better, IMO.

My initial reaction was that 2 was easier to understand, but after looking through it for a while, 1 is my preference as it removed the verbose wording about the middleware and makes it clear what’s happening.

1 Like

First approach i think is more elegant and clearer, however second is more intuitive and understandable but in my opinion first is better choice.