This class is a simple utility to perform string transformations while copying from stream-to-stream. It has been tested on a 1.48GiB malformed XML document to correct some syntax errors, where find and replace in Sublime Text would fail.
Usage is simple:
$transformer = new TransformingStream(STDIN, STDOUT);
$transformer->transform('/foo(bar)?/', 'baz$1');
$transformer->process();
This class is more suited to CLI usage than web, due to the possible runtime of text transformation over very large files.