Hello all,

I want to try to make a case for some changes on the PSR.

I realize it's been through a few iterations, but as a user of psr-7 
middleware I don't see myself adopting the current 15 and here's why.

1) $frame
I have no idea what $frame represents, I cannot explain it to another 
programmer. It is not required. It is merely some kind of syntax sugar, 
that is unreadable.

Ditching frame would leave the signature like so.
function (RequestInterface $request, callable $next);

2) I very much want double pass.

I want to approach this from a few different angles [I am a middleware 
writer, framework maintainer and a framework user... Love multiple hats]


Let's look at it from a *middleware writer's prespective (likely a bit 
bigger than framework maintainers)*
With Double pass, I get a response, I return a response... very simple. I 
focus on doing some kind of unit of work and that's it.

With Single-Pass:
I have to architect a middleware class structure to utilize Factories to 
generate responses to reduce code duplication... Single-pass... much more 
complicated :-1:


*Framework Maintainer (Smallest Group)*

With double-pass: 
- I generated a Response and a Request from the environment and execute the 
stack and render the final output... 

With Single-Pass: 
- I generate a Request from the environment and execute the stack and 
render the final output... Less work :+1:


*Framework User (Largest group)*

With Double-Pass: 
 - I return a response from my route action... with content or a status 
code. Simple and oddly enough Less work! :+1:

With Single Pass:
 - I have to figure out how to create a response object using the framework 
factory implementation :-1: Using the factory method is duplication because 
you will be using this in every Controller/Action. Even if you abstract 
this away, it's still another method call on every Route Action, instead of 
a single call at the framework level. This results in DRY violation [I know 
its super minor].
 - I have to render the content and return...

Double pass is great because we can lower the barrier to entry on our 
frameworks. New Programmers can pick up a project like Slim Framework and 
be immediately productive [that's why I love it so much]... If we force our 
users to use some kind of Factories, that raises the barrier to entry and 
raises the minimum knowledge required to be productive and I think that's a 
step backwards.


Finally, I want to emphasize that the double pass choice has been made in 
other communities as well. One that I am familar with is Express.JS in Node 
land, and it makes it easy transitioning from one language to another [I 
have done both php and node work]. [https://expressjs.com/en/4x/api.html] 

I am not on board with breaking a well defined cross-community informal 
standard.

I know MWOP has his reason for suggesting the edits, and I do think that 
they are better. However as a contributor to open source and helper of many 
novices/juniors/hobbyists/wordpressers I believe that the new changes are 
going to cause so many more introductory problems to modern frameworks... 
and to me that is undesirable.

Thank you for your time.
Glenn

-- 
You received this message because you are subscribed to the Google Groups "PHP 
Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/d5f4496b-46c0-4b18-801a-a2b4d345e8ac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to