PHPackages                             intriro/stream - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. intriro/stream

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

intriro/stream
==============

Provides a simple object-oriented abstraction over streams of data

0.4.0(5y ago)13.3kMITPHPPHP &gt;=7.4CI failing

Since May 15Pushed 5y ago2 watchersCompare

[ Source](https://github.com/intriro/stream)[ Packagist](https://packagist.org/packages/intriro/stream)[ RSS](/packages/intriro-stream/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (3)Versions (5)Used By (0)

Intriro Stream
==============

[](#intriro-stream)

Provides a simple object-oriented abstraction over streams of data.

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

[](#installation)

```
composer require intriro/stream
```

Documentation
-------------

[](#documentation)

Stream object by themselves don't have any methods for reading or writing. They just hold a reference to a PHP resource with some convenience methods to get information about the status of the stream.

### Create a stream

[](#create-a-stream)

You can create streams from an existing resource.

```
$resource = fopen('/home/test/file.txt', 'rw+');

$stream = Stream::createFromResource($resource);

```

You can also create streams directly from a filename or a URL-style protocol. The URL can be in the format that is supported by [fopen](https://www.php.net/manual/en/function.fopen.php).

```
$stream = Stream::createFromFilename('file:///home/test/file.txt', 'r');
$stream = Stream::createFromUrl('php://temp', 'r');

```

You can also use the convenience methods provided by the `StreamFactory` or `IoStreamFactory` to create streams.

```
$factory = new StreamFactory();
$stream = $streamFactory->filename(/home/test/file.txt', 'rw+');

$ioStreamFactory = new IoStreamFactory();
$stream = $ioStreamFactory->temp();
$stream = $ioStreamFactory->memory();
$stream = $ioStreamFactory->stdin();
$stream = $ioStreamFactory->stdout();
$stream = $ioStreamFactory->stderr();

```

### Reading and writing to a stream

[](#reading-and-writing-to-a-stream)

Manipulation of streams is done through readers and writers.

#### Reading from a stream

[](#reading-from-a-stream)

```
$reader = new Reader(
    Stream::createFromFilename('/home/test/file.txt', 'r')
);

$reader->read(100); // will read 100 bytes from the stream

// Reading lines from a stream
$reader = new LineReader(
    Stream::createFromFilename('/home/test/file.txt', 'r')
);

while($line = $reader->readLine()) {
    // do something
}

```

#### Writing to a stream

[](#writing-to-a-stream)

```
$ioStreamFactory = new IoStreamFactory();

$writer = new Writer(
    $ioStreamFactory->temp()
);

$writer->write('some text');

```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 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

Every ~125 days

Total

4

Last Release

1864d ago

PHP version history (2 changes)0.1.0PHP ^7.4

0.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/380fd037fb71854d3d53a7713137bb38385b5ecea2419917032c6f40ce3d681c?d=identicon)[intriro](/maintainers/intriro)

---

Top Contributors

[![alsar](https://avatars.githubusercontent.com/u/1380676?v=4)](https://github.com/alsar "alsar (10 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleECS

Type Coverage Yes

### Embed Badge

![Health badge](/badges/intriro-stream/health.svg)

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

###  Alternatives

[prezent/grid

Generic data grids and lists

1327.6k1](/packages/prezent-grid)

PHPackages © 2026

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