PHPackages                             pedrotroller/phpetroleum - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. pedrotroller/phpetroleum

ActiveLibrary

pedrotroller/phpetroleum
========================

Because at least one good thing comes from petroleum industry

v1.0.0(11y ago)0971MITPHP

Since Jul 4Pushed 8y agoCompare

[ Source](https://github.com/PedroTroller/PHPetroleum)[ Packagist](https://packagist.org/packages/pedrotroller/phpetroleum)[ RSS](/packages/pedrotroller-phpetroleum/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

PHPetroleum
===========

[](#phpetroleum)

---

Because at least one good thing comes from petroleum industry

[![Build Status](https://camo.githubusercontent.com/435f21dd00114cf024fdd24fcca852c997e738a4f2abe055f1138825e6bfeb28/68747470733a2f2f7472617669732d63692e6f72672f506564726f54726f6c6c65722f5048506574726f6c65756d2e737667)](https://travis-ci.org/PedroTroller/PHPetroleum)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/bb2f2ab5e15a024957ee5fd7cd7efb8ba595e37096d95989cb3aa7e68b1a078c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f506564726f54726f6c6c65722f5048506574726f6c65756d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PedroTroller/PHPetroleum/?branch=master)

Installation
------------

[](#installation)

```
composer require pedrotroller/phpetroleum ~1.0.0
```

Usage
-----

[](#usage)

### Create a simple pipe

[](#create-a-simple-pipe)

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

Then you, are able to write some content on this Pipe

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

Or you can wait for content

```
$content = $pipe->read();
```

### Use stream

[](#use-stream)

#### One-way stream

[](#one-way-stream)

```
$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);
```

#### Two-way stream

[](#two-way-stream)

This stream is using tow pipes, one to read content, the other one to answer.

```
$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');
```

How did it works
----------------

[](#how-did-it-works)

The Pipe object will push two elements into the pipe file, the message size and the message itself. By default, the message size is stored into 8 bytes but you can change the size. For exemle, if you write `test`, the entire message will be `00000004test` (`00000004` is the size for the message, `test` the message itself) If you set the message size length to 6 (`php $pipe = new PHPetroleum\Pipe('/tmp/file', 6); `) `test` will be stored `000004test`

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4336d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/30a9dae2aee580e835b4f60b16a1ac2cbc72cf6524a345cdae5a64e9c6ac75a6?d=identicon)[PedroTroller](/maintainers/PedroTroller)

---

Top Contributors

[![PedroTroller](https://avatars.githubusercontent.com/u/1766827?v=4)](https://github.com/PedroTroller "PedroTroller (8 commits)")

### Embed Badge

![Health badge](/badges/pedrotroller-phpetroleum/health.svg)

```
[![Health](https://phpackages.com/badges/pedrotroller-phpetroleum/health.svg)](https://phpackages.com/packages/pedrotroller-phpetroleum)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
