2017 © Pedro Peláez
 

library indentation-react

image

legionth/indentation-react

  • Thursday, September 14, 2017
  • by legionth
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

legionth/indentation-react

This project should show how awesome streams are and why they should be used. This project use a combination of writable and readable streams. Checkout the Usage for more information., (*1)

Table of Contents * Usage * Indenter * Install * License, (*2)

Usage

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., (*3)

To use this data you have to pipe it into another stream, checkout the examples folder., (*4)

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., (*5)

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., (*6)

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

This command can be started on its own., (*7)

$ 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., (*8)

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

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

or just add two spaces instead of four:, (*10)

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

Use it in your production code like this;, (*11)

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

The $beginningString can be any kind of string. Whatever you prefer ;), (*12)

Install

The recommended way to install this library is through Composer. New to Composer?, (*13)

This will install the latest supported version:, (*14)

$ composer require legionth/indentation-react:^0.1

See also the CHANGELOG for details about version upgrades., (*15)

License

MIT, (*16)

The Versions

14/09 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen

14/09 2017

dev-update-travis

dev-update-travis

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen

11/10 2016

dev-changable-idententer

dev-changable-idententer

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen

04/10 2016

v0.2.1

0.2.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen

04/10 2016

v0.2.0

0.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen

30/09 2016

v0.1.0

0.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Niels Theen