Download the PHP package phpro/resource-stream without Composer
On this page you can find all versions of the php package phpro/resource-stream. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download phpro/resource-stream
More information about phpro/resource-stream
Files in phpro/resource-stream
Package resource-stream
Short Description A safe OOP wrapper around resource streams
License MIT
Informations about the package resource-stream
Resource Stream
A safe OOP wrapper around resource streams in PHP:
- No need to worry about streams that have been closed.
- Instead of returning
false, detailed exceptions are thrown when something goes wrong. - Streams are automatically closed when the object is destructed (with option to opt-out).
- Handy factory methods for common streams.
Installation
Usage
Built-in Streams
The following streams are available by default:
CliStream
Can be used to open up CLI stdin, stdout and stderr streams.
FileStream
Validates if the local file exists and opens it up for you to use.
IOStream
Can be used to open up CGI php://input and php://output streams.
MemoryStream
Creates an in-memory stream for you to use.
Psr7Stream
Creates a stream from a PSR-7 stream / request / response.
before you can use this stream, you'll need to install the guzzlehttp/psr-7 package which contains a stream wrapper implementation.
TmpStream
Creates a temporary file and opens it up for you to use. After the stream is closed, the temporary file will be removed.
ZipStream
Opens a single entry from a zip archive as a read-only stream.
Validates that the archive exists before opening; failures (missing entry, corrupt archive, wrong/missing password) surface as a StreamActionFailureException carrying the underlying PHP message.
Note: the zip:// stream wrapper is read-only. To write into an archive, use PHP's ZipArchive directly.