PHPackages                             twistor/stream-util - 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. twistor/stream-util

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

twistor/stream-util
===================

Helper utilities for dealing with streams.

v1.0.1(10y ago)92.7M—6.1%8[4 PRs](https://github.com/twistor/stream-util/pulls)2MITPHPPHP &gt;=5.3.0

Since May 29Pushed 4y agoCompare

[ Source](https://github.com/twistor/stream-util)[ Packagist](https://packagist.org/packages/twistor/stream-util)[ Docs](http://github.com/twistor/stream-util)[ RSS](/packages/twistor-stream-util/feed)WikiDiscussions master Synced 1mo ago

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

Stream Utilities
================

[](#stream-utilities)

[![Author](https://camo.githubusercontent.com/500fb500f7a40e695210673a6780846051d0a17b3e1f79138f08165460f2999f/687474703a2f2f696d672e736869656c64732e696f2f62616467652f617574686f722d4063687269736c657070616e656e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://twitter.com/chrisleppanen)[![Build Status](https://camo.githubusercontent.com/e5e11d5c3d438c7e924b9a9481154e472e828be52ddc7ddac2f21ca332717dcb/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f74776973746f722f73747265616d2d7574696c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/twistor/stream-util)[![Coverage Status](https://camo.githubusercontent.com/45b1cc18b793cc4541c536b968a160d2cc346e51a89124bbffee376d69a05616/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f74776973746f722f73747265616d2d7574696c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/twistor/stream-util/code-structure)[![Quality Score](https://camo.githubusercontent.com/462ad395ea2e90686742bdd7077e7e0e6df6b7a0b4e080996908439e75b0c91d/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f74776973746f722f73747265616d2d7574696c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/twistor/stream-util)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/23444068e55c20e599052f66dd10928c96c43f723fdb3272effc07861e735562/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74776973746f722f73747265616d2d7574696c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/twistor/stream-util)

Helper functions for dealing with streams.

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

[](#installation)

```
composer require twistor/stream-util

```

Usage
-----

[](#usage)

```
use Twistor\StreamUtil;

$stream = fopen('php://temp', 'w+b');

fwrite($stream, 'asdfasfdas');

$cloned = StreamUtil::copy($stream, false); // Passing in true (the default),
                                            // will close the input stream.

StreamUtil::getSize($stream); // 10

StreamUtil::isAppendable($stream); // false

StreamUtil::isReadable($stream); // true

StreamUtil::isSeekable($stream); // true

StreamUtil::isWritable($stream); // true

StreamUtil::tryRewind($stream);  // true

StreamUtil::trySeek($stream, 0, SEEK_END); // true

// Metadata helpers.
StreamUtil::getMetaDataKey($stream, 'blocked') // false

StreamUtil::getUri($stream); // php://temp

StreamUtil::getUsuableUri($stream); // Returns a URI that can be used
                                    // with fopen().
                                    // false in this case.

// Mode helpers.
StreamUtil::modeIsAppendable('w+'); // false

StreamUtil::modeIsAppendOnly('a+'); // false

StreamUtil::modeIsReadable('w+');   // true

StreamUtil::modeIsReadOnly('r');    // true

StreamUtil::modeIsWritable('r+');   // true

StreamUtil::modeIsWriteOnly('w');   // true
```

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity59

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 ~14 days

Total

2

Last Release

3994d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5125606781d4fe5f77b01cd43ae43863dd8d5ccde938e7b25dc7a40d0d46eb07?d=identicon)[twistor](/maintainers/twistor)

---

Top Contributors

[![twistor](https://avatars.githubusercontent.com/u/42400?v=4)](https://github.com/twistor "twistor (21 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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