CallbackStreamWrapper
    
            
            in package
            
        
    
    
    
Stream wrapper that allows writing data to a callback function.
This wrapper creates a virtual stream that forwards all written data to a provided callback function, enabling custom output handling such as streaming to HTTP responses, files, or other destinations.
Tags
Table of Contents
Constants
- PROTOCOL = 'zipcb'
Properties
- $context : resource|null
Methods
- __destruct() : mixed
- Destructor - ensures cleanup even if stream_close() isn't called.
- open() : resource|false
- Create a new callback stream.
- stream_close() : void
- Close the stream and clean up callback.
- stream_eof() : bool
- Check if stream has reached end of file.
- stream_flush() : bool
- Flush stream buffers.
- stream_open() : bool
- Open the stream.
- stream_read() : string
- Read data from stream (not supported - write-only stream).
- stream_seek() : bool
- Seek to position in stream (not supported).
- stream_set_option() : bool
- Set options on stream (not supported).
- stream_stat() : array<string, mixed>
- Get stream statistics.
- stream_tell() : int
- Get current position in stream.
- stream_truncate() : bool
- Truncate stream (not supported).
- stream_write() : int
- Write data to the callback.
Constants
PROTOCOL
    public
        mixed
    PROTOCOL
    = 'zipcb'
    
    
    
    
Properties
$context
        public
            resource|null
    $context
    
    
    
    
    
    
Methods
__destruct()
Destructor - ensures cleanup even if stream_close() isn't called.
    public
                    __destruct() : mixed
    Prevents memory leaks in long-running processes.
open()
Create a new callback stream.
    public
            static        open(callable(string): void $callback) : resource|false
    Parameters
- $callback : callable(string): void
- 
                    Function to call with written data 
Return values
resource|false —Stream resource or false on failure
stream_close()
Close the stream and clean up callback.
    public
                    stream_close() : void
    stream_eof()
Check if stream has reached end of file.
    public
                    stream_eof() : bool
    Return values
bool —Always false for write-only streams
stream_flush()
Flush stream buffers.
    public
                    stream_flush() : bool
    Return values
bool —Always true (no buffering)
stream_open()
Open the stream.
    public
                    stream_open(string $path, string $mode, int $options, string|null &$opened_path) : bool
    Parameters
- $path : string
- 
                    Stream path containing the callback ID 
- $mode : string
- 
                    File mode (must contain 'w' for writing) 
- $options : int
- 
                    Stream options (required by interface, unused) 
- $opened_path : string|null
- 
                    Opened path reference (required by interface, unused) 
Tags
Return values
bool —True if stream opened successfully
stream_read()
Read data from stream (not supported - write-only stream).
    public
                    stream_read(int $count) : string
    Parameters
- $count : int
- 
                    Number of bytes to read (required by interface, unused) 
Tags
Return values
string —Always empty string
stream_seek()
Seek to position in stream (not supported).
    public
                    stream_seek(int $offset[, int $whence = SEEK_SET ]) : bool
    Parameters
- $offset : int
- 
                    Offset to seek to (required by interface, unused) 
- $whence : int = SEEK_SET
- 
                    Seek mode (required by interface, unused) 
Tags
Return values
bool —Always false
stream_set_option()
Set options on stream (not supported).
    public
                    stream_set_option(int $option, int $arg1, int $arg2) : bool
    Parameters
- $option : int
- 
                    Option to set (required by interface, unused) 
- $arg1 : int
- 
                    First argument (required by interface, unused) 
- $arg2 : int
- 
                    Second argument (required by interface, unused) 
Tags
Return values
bool —Always false
stream_stat()
Get stream statistics.
    public
                    stream_stat() : array<string, mixed>
    Return values
array<string, mixed> —Stream statistics
stream_tell()
Get current position in stream.
    public
                    stream_tell() : int
    Return values
int —Current position
stream_truncate()
Truncate stream (not supported).
    public
                    stream_truncate(int $new_size) : bool
    Parameters
- $new_size : int
- 
                    New size (required by interface, unused) 
Tags
Return values
bool —Always false
stream_write()
Write data to the callback.
    public
                    stream_write(string $data) : int
    Parameters
- $data : string
- 
                    Data to write 
Tags
Return values
int —Number of bytes written