PhpInputStream
class PhpInputStream extends Stream implements StreamInterface (View source)
The PhpInputStream class.
Constants
MODE_READ_ONLY_FROM_BEGIN |
|
MODE_READ_WRITE_FROM_BEGIN |
|
MODE_WRITE_ONLY_RESET |
|
MODE_READ_WRITE_RESET |
|
MODE_WRITE_ONLY_FROM_END |
|
MODE_READ_WRITE_FROM_END |
|
Methods
Class init.
Reads all data from the stream into a string, from the beginning to end.
Method to attach resource into object.
Returns whether or not the stream is writable.
Read data from the stream.
Returns the remaining contents in a string
Get stream metadata as an associative array or retrieve a specific key.
Details
at line line 39
__construct(string|resource $stream = 'php://input')
Class init.
at line line 59
string
__toString()
Reads all data from the stream into a string, from the beginning to end.
This method MUST attempt to seek to the beginning of the stream before reading data and read the stream until the end is reached.
Warning: This could attempt to load a large amount of data into memory.
This method MUST NOT raise an exception in order to conform with PHP's string casting operations.
Stream
attach(string|resource $stream, string $mode = 'r')
Method to attach resource into object.
resource|null
detach()
Separates any underlying resources from the stream.
After the stream has been detached, the stream is in an unusable state.
boolean
seek(int $offset, int $whence = SEEK_SET)
Seek to a position in the stream.
rewind()
Seek to the beginning of the stream.
If the stream is not seekable, this method will raise an exception; otherwise, it will perform a seek(0).
at line line 76
bool
isWritable()
Returns whether or not the stream is writable.
at line line 93
string
read(int $length)
Read data from the stream.
at line line 117
string
getContents($maxLength = -1)
Returns the remaining contents in a string
array|mixed|null
getMetadata(string $key = null)
Get stream metadata as an associative array or retrieve a specific key.
The keys returned are identical to the keys returned from PHP's streamgetmeta_data() function.