PHPackages                             exsyst/io - 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. exsyst/io

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

exsyst/io
=========

Object-oriented I/O facility

0.2.0(9y ago)36.4k3Apache-2.0PHPPHP &gt;=5.5

Since Sep 14Pushed 9y ago2 watchersCompare

[ Source](https://github.com/EXSyst/IO)[ Packagist](https://packagist.org/packages/exsyst/io)[ RSS](/packages/exsyst-io/feed)WikiDiscussions master Synced 1mo ago

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

[![Build Status](https://camo.githubusercontent.com/6c8aa43bf1635b6dc180737051c3565f34167f264ae01e0f14c687c1ee4fc699/68747470733a2f2f7472617669732d63692e6f72672f4558537973742f494f2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/EXSyst/IO)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b2ebada5f63d8fe08d0e6b8f17cdee3f96bf9d38e050c3627ad8b91c9ca84adc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4558537973742f494f2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/EXSyst/IO/?branch=master)

EXSyst I/O Component
====================

[](#exsyst-io-component)

Object-oriented I/O facility

`Source`s
---------

[](#sources)

The `Source` objects (objects implementing `SourceInterface`) can be used to read raw chunks of data from several sources :

- `StringSource`s can be used to read data from a string ;
- `StreamSource`s can be used to read data from a PHP stream resource, **without protection from most flaws** in the implementation of the wrapped PHP stream ; they can also be used as `Sink`s (read more in the next section) if the stream is writable or bidirectional ;
- `BufferedSource`s can be used to wrap other sources, in order to fix several flaws which their implementation may have, and add missing features (for example, haven't you already needed, if only once, to seek backwards on a socket ?) ;
- `OuterSource`s are abstract : you may extend them to provide additional services on existing `Source`s (for example, `BufferedSource`s and `Reader`s are `OuterSource`s).

You may create `Source`s directly from the classes' constructors, or using static methods from the `Source` class, which may provide additional services (for example, `fromStream` and `fromFile` automatically wrap the `StreamSource`s in `BufferedSource`s by default).

The `Source` class also provides static utility methods.

`Sink`s
-------

[](#sinks)

The `Sink` objects (objects implementing `SinkInterface`) can be used to write raw chunks of data to several sinks :

- `StringSink`s can be used to build strings (but may be slower than plain concatenation : beware of call overhead !) ;
- The `SystemSink` is a simple wrapper for `echo` ; it is a singleton ;
- `RecordFunctionSink`s can be used to aggregate data into records (of fixed size, or delimited by a separator, with an optional size limit) and pass them to a custom function ;
- `StreamSource`s (see the previous section) which wrap a writable or bidirectional stream can be used to write data to a PHP stream resource ;
- `TeeSink`s can be used to duplicate data into multiple `Sink`s.

Like the `Source` class, the `Sink` class provides static methods which can be used to easily create `Sink`s, and static utility methods.

`State`s
--------

[](#states)

The `State` objects (objects implementing `StateInterface`) can be obtained by calling `captureState` on a `Source` which supports it. They can be used to rewind the `Source` to a previous position using the `restore` method.

You can wrap your `Source` in a `BufferedSource` if you need to rewind it and if it doesn't support it.

`Reader`s
---------

[](#readers)

The `Reader` objects (which do not implement any specific interface, as they provide much different services) can be used to read structured data from `Source`s :

- `CDataReader`s can be used to ease the writing of lexers : they support `eat`ing fixed strings, strings including or excluding only given character classes, and white space ;
- `StringCDataReader`s are `CDataReader`s optimized for `StringSource`s, which additionally suppport `eat`ing strings matching a regular expression (using `preg_match`) ;
- `SerializedReader`s can be used to separate concatenated `serialize`d values (as in `serialize($foo).serialize($bar)`), regardless of whether they come from a local `Source` (such as a string or a file stream) or a remote one (such as a pipe or network stream) ; they are explicitly designed to work efficiently with remote `Source`s ;
- `JsonReader`s can be used to separate concatenated JSON (as specified by [RFC 7159](https://tools.ietf.org/html/rfc7159)) values, in the same conditions as `SerializedReader`.

It is recommended to create `CDataReader`s using the `fromSource` static method : it will automatically prefer an optimized implementation (such as `StringCDataReader`) when applicable.

`Channel`s
----------

[](#channels)

The `Channel` objects (objects implementing `ChannelInterface`) can be used to communicate with remote tasks using messages, which will be serialized if necessary :

- `SerializedChannel`s serialize the messages using the native PHP format (with `serialize`) ;
- `JsonChannel`s serialize the messages using JSON (as specified by [RFC 7159](https://tools.ietf.org/html/rfc7159)).

The `ChannelFactory` objects (objects implementing `ChannelFactoryInterface`) can be used by an application or a library to specify an encoder/decoder couple, along with their parameters, to another library.

`Selectable`s
-------------

[](#selectables)

The `Selectable` objects (objects implementing `SelectableInterface`) are objects which wrap PHP streams. They can be passed to the static methods of the `Selectable` class, which are object-oriented wrappers to `stream_select`. These methods can look for `Selectable`s wrapped in arbitrarily many `OuterSource`s, and will let the originally passed objects (not the inner `Selectable`s) in the sets on return.

Many objects are `Selectable` : `StreamSource`s, all `Channel`s, and objects of the `Selectable` class itself : in addition to its static utility methods, it provides a bare-bones implementation of the interface (which you can use to, for example, add a server socket to your set).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community14

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

Total

2

Last Release

3562d ago

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/8789b6246ea714f84b9ea6490a1d75175205e9c130e076ee20ccff121fb916df?d=identicon)[Exter-N](/maintainers/Exter-N)

---

Top Contributors

[![Exter-N](https://avatars.githubusercontent.com/u/2236342?v=4)](https://github.com/Exter-N "Exter-N (37 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/exsyst-io/health.svg)

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

###  Alternatives

[sensiolabs/storybook-bundle

Bundle to use Storybook with Symfony UX packages.

5786.2k](/packages/sensiolabs-storybook-bundle)[flarum/sticky

Pin discussions to the top of the list.

10411.8k10](/packages/flarum-sticky)

PHPackages © 2026

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