Stream-Interop Now Open For Public Review
Many thanks to the private reviewers and collaborators on this project thus far. Special thanks to Nathan Bishop for starting this project, and for his generous donation of the Github organization and the Packagist vendor space. Special thanks also to Akihito Koriyama for his encouragement and advice on this and related
*-interop
projects.
After a period of private review, the stream-interop/interface package is now open for public review.
Stream-Interop publishes interoperable interfaces providing a more object-oriented approach to encapsulating and interacting with stream resources in PHP 8.4+. It reflects, refines, and reconciles the common practices identified within several pre-existing projects.
The package defines separate interfaces for various affordances around stream resources so that (1) implementations can advertise well-tailored affordances, and (2) consumers can typehint to the specific affordances they require for specific situations:
- Stream is a common baseline for streams.
- ResourceStream affords direct access to the encapsulated resource.
- ClosableStream affords closing the stream.
- SizableStream affords getting the full length of the stream in bytes.
- ReadableStream affords reading from the stream.
- SeekableStream affords moving the stream pointer.
- StringableStream affords casting the stream to a string.
- WritableStream affords writing to the stream.
The reference implementations demonstrate how the interfaces can be combined in various ways to implement everything from a simple ConsumableFileStream to a lazy ghost ReadWriteFile.
If you use streams and are interested an interoperable set of interfaces, please offer your comments and criticism as issues or PRs out at Github.