PHPackages                             legionth/indentation-react - 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. legionth/indentation-react

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

legionth/indentation-react
==========================

v0.2.1(9y ago)018[1 issues](https://github.com/legionth/php-indentation-react/issues)MITPHPPHP &gt;=5.3

Since Sep 30Pushed 8y ago1 watchersCompare

[ Source](https://github.com/legionth/php-indentation-react)[ Packagist](https://packagist.org/packages/legionth/indentation-react)[ RSS](/packages/legionth-indentation-react/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

legionth/indentation-react
==========================

[](#legionthindentation-react)

This project should show how awesome [streams](https://github.com/reactphp/stream) are and why they should be used. This project use a combination of writable and readable streams. Checkout the [Usage](#usage) for more information.

**Table of Contents**

- [Usage](#usage)
- [Indenter](#indenter)
- [Install](#install)
- [License](#license)

Usage
-----

[](#usage)

### Indenter

[](#indenter)

The center of this project is the `Indenter` class. This class (obviously) indents the incomig stream into an outgoing stream. The `Indenter` is an `EventEmitter` and a `ReadableStreamInterface`. Because this class is a `ReadableStreamInterface` the indented data will be exposed on the same interface.

To use this data you have to pipe it into another stream, checkout the `examples` folder.

So what is the reason for this project? This project just shows how awesome the ReactPHP streams are. Streams can come in different sizes: bigger parts, smaller parts, etc. depending on your data source(Downloads, Files, Strings ...). In this project you can be sure a chunk is complete when the new line delimiter comes in, so the next line will be indented. So you can be sure the stream is always correctly indented.

You can find under `examples` how you can use this project. If you need a file to be indented you can pipe the file into the example.

```
$ cat words.txt | php examples/indentInput.php

```

This command can be started on its own.

```
$ php examples/indentInput.php

```

This example makes clear why this project should be used. You can indent a whole file with one little example. If you want, you can pipe a command output into this example to see how it works. Just try it.

You can use other indentation methods as the standard 4 spaces e.g. (Tabs, more or fewer spaces) by using it like this

```
$ cat words.txt | php examples/indentInput.php --tab

```

or just add two spaces instead of four:

```
$ cat words.txt | php examples/indentInput.php --spaces 2

```

Use it in your production code like this;

```
$indenter = new Indenter($inputStream);
// or
$indenter = new Indenter($inputStream, $beginningString);
```

The `$beginningString` can be any kind of string. Whatever you prefer ;)

Install
-------

[](#install)

The recommended way to install this library is [through Composer](https://getcomposer.org). [New to Composer?](https://getcomposer.org/doc/00-intro.md)

This will install the latest supported version:

```
$ composer require legionth/indentation-react:^0.1
```

See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades.

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

3

Last Release

3557d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1578709?v=4)[Niels Theen](/maintainers/legionth)[@legionth](https://github.com/legionth)

---

Top Contributors

[![legionth](https://avatars.githubusercontent.com/u/1578709?v=4)](https://github.com/legionth "legionth (20 commits)")

### Embed Badge

![Health badge](/badges/legionth-indentation-react/health.svg)

```
[![Health](https://phpackages.com/badges/legionth-indentation-react/health.svg)](https://phpackages.com/packages/legionth-indentation-react)
```

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k245.4M24.0k](/packages/friendsofphp-php-cs-fixer)[react/react

ReactPHP: Event-driven, non-blocking I/O with PHP.

9.1k3.6M65](/packages/react-react)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34185.8M150](/packages/react-child-process)[clue/utf8-react

Streaming UTF-8 parser, built on top of ReactPHP.

6610.7M3](/packages/clue-utf8-react)[llm/mcp-server

PHP SDK for building MCP servers

441.3k](/packages/llm-mcp-server)

PHPackages © 2026

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