Hoa\Stream, hack book – Hoa


#1
This library is a high-level abstraction over PHP streams. It includes: * Stream manipulations: Open, close, auto-close, timeout, blocking mode, buffer size, metadata etc., * Stream notifications: Depending of the stream wrapper, the supported listeners are the following: `authrequire`, `authresult`, `complete`, `connect`, `failure`, `mimetype`, `progress`, `redirect`, `resolve`, and `size`, * Context: Allow to pass options and parameters to the stream wrappers, for instance HTTP headers, * Filter: A function that sits between the source and the destination of a stream, useful for instance to encrypt/decrypt a data on-the-fly, or for more advanced tricks like instrumentation, * Wrapper: Declare user-defined protocols that will naturally be handled by the PHP standard library (like `fopen`, `stream_get_contents` etc.), * Interfaces: One interface per capability a stream can offer. This library is the foundation of several others, e.g. [`Hoa\File`](https://central.hoa-project.net/Resource/Library/File) or [`Hoa\Socket`](https://central.hoa-project.net/Resource/Library/Socket) (and so [`Hoa\Websocket`](https://central.hoa-project.net/Resource/Library/Websocket)).
This is a companion discussion topic for the original entry at https://hoa-project.net/En/Literature/Hack/Stream.html