PHP code example of pedrotroller / phpetroleum

1. Go to this page and download the library: Download pedrotroller/phpetroleum 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/ */

    

pedrotroller / phpetroleum example snippets


$pipe = new PHPetroleum\Pipe('/tmp/pipe');

$pipe->write('some content');

$content = $pipe->read();

$pipe   = new PHPetroleum\Pipe('/tmp/input');
$stream = new PHPetroleum\Stream\ReaderStream($pipe);
$content = $stream->read();

$pipe   = new PHPetroleum\Pipe('/tmp/output');
$stream = new PHPetroleum\Stream\WriterStream($pipe);
$stream->write($content);

$input   = new PHPetroleum\Pipe('/tmp/input');
$output  = new PHPetroleum\Pipe('/tmp/output');
$stream  = new PHPetroleum\Stream\TwoWayStream($input, $output);
$content = $stream->read();
$stream->write('Other content');
 $pipe = new PHPetroleum\Pipe('/tmp/file', 6);