On 10/30/14, 1:23 PM, Sherif Ramadan wrote:
Hello Internals,

I've been meaning to write up a full-blown RFC for introducing a new
standardized HTTP interface for PHP core for some time now. I figure now
with PHP 7 on the road map this might be a good time to start this
discussion since it involves breaking some backwards compatibility that may
have been out of the question in PHP 5.

*snip*

I'm in the process of writing up a cleaner implementation to introduce in
the RFC, but in the mean time I'd like to open up to discussion and see
what others think or how they feel we might approach this problem more
cleanly.

Thanks,
Sherif

As you note, there's an enormous amount of existing and active discussion around PSR-7 on the FIG mailing list, and I would urge anyone pursuing such an effort for core to read through that discussion in detail. There are a lot of tricky bits that we have been hashing through that you don't want to hash through again, especially around supported use cases.

In practice, honestly, I think userspace can experiment and innovate here better than internals can, at least for a while. The main place where core could help would be streams. One of the things we're still struggling with is supporting message bodies (request or response) that can be strings OR a stream, such as a file off disk that we don't want in memory all at once, OR a callable that generates output on the fly (say, reading records out of a DB and generating a CSV file).

Part of the problem is that the native streams API, while powerful, is horribly annoying to work with. Michael Dowling has documented many of the issues with it from a request/response perspective here:

http://mtdowling.com/blog/2014/07/03/a-case-for-higher-level-php-streams/

Honestly, I think one of the best things internals could do to help really robust request/response support for PHP 7 isn't writing a new interface, but improving the streams API in order to simplify the many use cases we've identified (and render the whole "detach" stuff we're looking at now unnecessary).

--Larry Garfield

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to