PSR for Streams

145 views
Skip to first unread message

Andrew Carter

unread,
Nov 25, 2015, 9:46:05 AM11/25/15
to PHP Framework Interoperability Group
Hello,

This thread is to try and gauge (and attract) support for a stream PSR.

It appears that lots of other potential PSR's would utilise this interface and the PSR-7 contributors have already done the hard yards here.

I've opened a pull request which is just a stripped down version of PSR-7.

https://github.com/php-fig/fig-standards/pull/682

Is there a demand for this and would anyone like to sponsor or co-ordinate this proposal?

Best Regards,

Andrew

Andrew Carter

unread,
Nov 25, 2015, 10:06:54 AM11/25/15
to PHP Framework Interoperability Group
For reference, I don't think the final interface will be a direct fork of the stream interface from PSR-7.

On another thread in this group it has already been mentioned that changes might need to be made in light of the async PSRs that are being considered.

It might also be an idea to define a set of stream specific exceptions.

Niklas Keller

unread,
Nov 25, 2015, 10:14:28 AM11/25/15
to PHP Framework Interoperability Group
As already mentioned in the other thread, I think such a Stream PSR would depend on a previous Promise PSR. The current __toString() could then be transformed into something like buffer() returning a Promise, but that's an implementation detail for later.

Larry Garfield

unread,
Nov 25, 2015, 11:52:53 AM11/25/15
to php...@googlegroups.com
My main concern here is much the same as it was in PSR-7: PHP itself has
a stream API. It sucks, but it has one. :-) We should be trying to work
with internals to build a better stream API in C land that is extensible
from userspace, rather than trying to build a parallel implementation
that can sometimes maybe piggypack on the one in C, kind of.

--
--Larry Garfield

Andrew Carter

unread,
Nov 25, 2015, 12:26:01 PM11/25/15
to PHP Framework Interoperability Group
@crell

A lot of the PSRs in development (and one that has passed) need an abstraction such as this to use now. Even if there is movement inside internals towards a decent stream API it'll be years anything is actually available.

nathancarl...@gmail.com

unread,
Apr 25, 2019, 7:54:31 AM4/25/19
to PHP Framework Interoperability Group
I have created a stream-interop group based on an old project of mine. I am looking for developers and supporters alike to help build it. I feel like this is an abstraction that is desperately needed in PHP land. The original interfaces can be found here (including tests and an a concrete implementation): https://github.com/meekframework/stream

The new community-focused group can be found here: https://github.com/stream-interop/stream-interop

My hope is that it will one day be mature enough to make it to a PSR.

Reply all
Reply to author
Forward
0 new messages