PHP code example of kambo / httpstream

1. Go to this page and download the library: Download kambo/httpstream library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kambo / httpstream example snippets


$stringStream = new StringStream('foo');
$stringStream->getContents(); // returns 'foo'

$callback = function () {
    return 'bar';
};
$callbackStream = new CallbackStream($callback);
$callbackStream->getContents(); // Invoke function and returns 'bar'.
$callbackStream->getContents(); // stream is in detached state empty string ('') has been returned.