PHPackages                             takuya/php-stringio - 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. takuya/php-stringio

ActiveLibrary

takuya/php-stringio
===================

StringIO for stream(php://memory) object

0.1.1(1y ago)0741GPL-3.0-or-laterPHPCI passing

Since Mar 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/takuya/php-stringio)[ Packagist](https://packagist.org/packages/takuya/php-stringio)[ RSS](/packages/takuya-php-stringio/feed)WikiDiscussions master Synced 1w ago

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

StringIO
========

[](#stringio)

[![workflow](https://github.com/takuya/php-stringio/actions/workflows/actions.yml/badge.svg)](https://github.com/takuya/php-stringio/actions/workflows/actions.yml/badge.svg)

'string' as IO Stream Object. To avoid large string split into large array.

I know,Needless to say,`SplFileObject('php://memory','w+')` is best, but too much.

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

[](#installation)

```
composer require takuya/php-stringio

```

Usage
-----

[](#usage)

```
$sio = new StringIO("1234\n");
$sio->write("aaaa\n");
$sio->write("bbbb\n");
$sio->write("cccc\n");
$sio->rewind();
foreach ( $sio->lines() as $line) {
  var_dump($line);
}
$sio->close();
```

### Same to SplFileObject

[](#same-to-splfileobject)

```
$sio = new \SplFileObject('php://memory','w+');
$sio->fwrite("1234\n");
$sio->fwrite("aaaa\n");
$sio->fwrite("bbbb\n");
$sio->fwrite("cccc\n");
foreach ( $sio as $line) {
  var_dump(trim($line));
}
unset($sio);
```

[SplFileObject](https://www.php.net/manual/en/class.splfileobject.php) has too much inherited method.

### Differences to SplFileObject

[](#differences-to-splfileobject)

- trim() -- no new line(s such as "\\r","\\n")
- few methods -- no inherited methods
- f- prefix -- without f- ( fwrite/write )
- yield -- generator in lines()
- close -- SplFileObject does not have fclose()

### Methods

[](#methods)

- StringIO#rewind
- StringIO#seek
- StringIO#tell
- StringIO#resource
- StringIO#close
- StringIO#closed
- StringIO#readline
- StringIO#gets
- StringIO#write
- StringIO#get\_contents
- StringIO#eof
- StringIO#lines
- StringIO#get\_meta\_data
- StringIO#\_\_toString

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance46

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

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

Total

2

Last Release

427d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ab28766f469b5f1770a63613c5f51d661226e01bd2abd180ad5460e537e7d4fa?d=identicon)[takuya](/maintainers/takuya)

---

Top Contributors

[![takuya](https://avatars.githubusercontent.com/u/55338?v=4)](https://github.com/takuya "takuya (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/takuya-php-stringio/health.svg)

```
[![Health](https://phpackages.com/badges/takuya-php-stringio/health.svg)](https://phpackages.com/packages/takuya-php-stringio)
```

PHPackages © 2026

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