PHPackages                             stk2k/iostream - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. stk2k/iostream

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

stk2k/iostream
==============

Input and output stream library

0.2.1(4y ago)04MITPHPPHP &gt;=7.2

Since Jul 2Pushed 4y ago1 watchersCompare

[ Source](https://github.com/stk2k/iostream)[ Packagist](https://packagist.org/packages/stk2k/iostream)[ Docs](https://github.com/stk2k/iostream)[ RSS](/packages/stk2k-iostream/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (5)Versions (4)Used By (0)

Input and output stream library
===============================

[](#input-and-output-stream-library)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ce4fcded8541e69565ddeaae3bcc78a2a132519a6d1f821e4f8e63170b8a3c62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73746b326b2f696f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stk2k/iostream)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/184de48fdb7eb006f10eb73275e3216b6b9a7364c94465298fa3abdc22aa87e8/68747470733a2f2f6170692e7472617669732d63692e636f6d2f73746b326b2f696f73747265616d2e7376673f6272616e63683d6d61696e)](https://api.travis-ci.com/stk2k/iostream.svg?branch=main)[![Coverage Status](https://camo.githubusercontent.com/34f9aa6d56ca75210ac2a386ccd0a9722a5ba129ce42b96aad5133f3ecc7db58/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f73746b326b2f696f73747265616d2f62616467652e7376673f6272616e63683d6d61696e)](https://coveralls.io/repos/github/stk2k/iostream/badge.svg?branch=main)[![Code Climate](https://camo.githubusercontent.com/74fe39585fdf5261e1a25ea14f6796eebe28b5245feb5d4bf410af8cb0d99421/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f73746b326b2f696f73747265616d2f6261646765732f6770612e737667)](https://codeclimate.com/github/stk2k/iostream)[![Total Downloads](https://camo.githubusercontent.com/76381fa7a906b5fb03c70cb505f26743e604075b67c5235f828075f0d283d06e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73746b326b2f696f73747265616d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stk2k/iostream)

Description
-----------

[](#description)

Input and output stream library

Demo
----

[](#demo)

### StringInputStream

[](#stringinputstream)

```
use stk2k\iostream\string\StringInputStream;

// foreach
$sis = new StringInputStream('Hello');
foreach ($sis as $c){
    echo $c . '.';    // H.e.l.l.o.
}

// read
$sis = new StringInputStream('Hello');
while($c = $sis->read(1)){
    echo $c . '.';    // H.e.l.l.o.
}

// read line
$sis = new StringInputStream("Foo\nBar\nBaz");
while($line = $sis->readLine()){
    echo $line . '.';    // Foo.Bar.Baz.
}

// read lines
$sis = new StringInputStream("Foo\nBar\nBaz");
$lines = $sis->readLines();
echo implode('.', $lines);    // Foo.Bar.Baz
```

### PushBackStringInputStream

[](#pushbackstringinputstream)

```
use stk2k\iostream\string\PushBackStringInputStream;
use stk2k\xstring\xStringBuffer;

$sis = new PushBackStringInputStream(', World!');

$sis->unread(new xStringBuffer('olleH'));
echo $sis->readLine();          // Hello, World!
```

### FileInputStream

[](#fileinputstream)

```
use stk2k\filesystem\File;
use stk2k\iostream\file\FileInputStream;

// foreach
$file = new File('test/_files/b.txt');
$fis = new FileInputStream($file);
foreach ($fis as $c){
    echo $c . '.';    // H.e.l.l.o.
}

// read
$file = new File('test/_files/b.txt');
$fis = new FileInputStream($file);
while($c = $fis->read(1)){
    echo $c . '.';    // H.e.l.l.o.
}

// read line
$file = new File('test/_files/c.txt');
$fis = new FileInputStream($file);
while($line = $fis->readLine()){
    echo $line . '.';    // Foo.Bar.Baz.
}

// read lines
$file = new File('test/_files/c.txt');
$fis = new FileInputStream($file);
$lines = $fis->readLines();
echo implode('.', $lines);    // Foo.Bar.Baz
```

Requirement
-----------

[](#requirement)

PHP 7.2 or later

Installing stk2k/iostream
-------------------------

[](#installing-stk2kiostream)

The recommended way to install stk2k/iostream is through [Composer](http://getcomposer.org).

```
composer require stk2k/iostream
```

License
-------

[](#license)

[MIT](https://github.com/stk2k/iostream/blob/master/LICENSE)

Author
------

[](#author)

[stk2k](https://github.com/stk2k)

Disclaimer
----------

[](#disclaimer)

This software is no warranty.

We are not responsible for any results caused by the use of this software.

Please use the responsibility of the your self.

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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

Total

3

Last Release

1820d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/985640?v=4)[stk2k](/maintainers/stk2k)[@stk2k](https://github.com/stk2k)

---

Top Contributors

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

---

Tags

phpjsonlibrary

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stk2k-iostream/health.svg)

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

###  Alternatives

[juststeveking/resume-php

A PHP library for building and working with the JSON resume schema.

1061.0k](/packages/juststeveking-resume-php)[phppkg/config

Config manage, load, get. Supports INI,JSON,YAML,NEON,PHP format file

133.5k](/packages/phppkg-config)[blancks/fast-jsonpatch-php

Class designed to efficiently handle JSON Patch operations in accordance with the RFC 6902 specification

398.7k](/packages/blancks-fast-jsonpatch-php)[josantonius/json

PHP simple library for managing Json files.

1822.8k10](/packages/josantonius-json)[bupy7/xml-constructor

The array-like constructor of XML document structure.

1339.5k](/packages/bupy7-xml-constructor)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

286.9k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

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