Closed wolfy-j closed 3 years ago
P.S. we can also add “native” adjective after this patch.
Hm, ok, a will think about it
About one year later...
I have attempted to implement skipping PSR-7 request creation during the work under the fresh package version, and in two words - it's not worth the gamble. Reasons:
@wolfy-j can I close this issue?
@tarampampam There are really 4.5 transformations going on.
1) RAW Data -> Transport Frame (https://github.com/spiral/goridge-php/blob/master/src/StreamRelay.php#L74) 1.1) Unpacking Frame as HTTP 2) Frame -> DTO Request (https://github.com/spiral/roadrunner-http/blob/master/src/HttpWorker.php#L101-L109) 3) DTO -> PSR Request (https://github.com/spiral/roadrunner-http/blob/master/src/PSR7Worker.php#L91-L101) 4) PSR Request -> Symofny Request (As in the example above)
It is not worth getting rid of the low-level transformations, because there is a binary protocol and all sorts of checks. But it is possible to get rid of the transformations from DTO to PSR and then from PSR to Symfony. They are really unnecessary.
However, I agree that this is not very significant, if the task is not to speed up, but to ensure maximum compatibility and portability in the future =)
At the moment most of the extensions work using
symfony/psr-http-message-bridge
which converts PSR-7 request/response into Symfony/HttpKernel.The RoadRunner worker exposes low level API to access the incoming request data in the form of an array.
https://github.com/spiral/roadrunner-http/blob/master/src/HttpWorker.php
Essentially, it makes it possible to skip the PSR-7 implementation as whole and map data directly to Symfony Request/Response.
Benefits: