github.com/prewk/xml-string-streamer ↗

Stream large XML files with low memory consumption.

An animated visualization of prewk/xml-string-streamer's Git history from April 2014 to December 2020, built by 9 contributors. The codebase reached 234 lines, mostly PHP. The video runs 46 seconds.

Render your own repo

Turn any GitHub repository into a video like this — free sample in seconds.

Visualize your own →

Open this visualization on its own page →

Language

PHP

Contributors

9

Lines of Code

234

From

2014-04-26

To

2020-12-14

Advertisement

About prewk/xml-string-streamer

xml-string-streamer is a PHP library designed to parse extremely large XML files while using minimal memory. It allows developers to process XML documents that are too big to load into memory at once, making it useful for handling multi-gigabyte files in production environments.

The library provides two main parsing strategies. The StringWalker parser works similarly to PHP's XmlReader, traversing the XML tree node by node and capturing elements at a specified depth. The UniqueNode parser offers faster performance by capturing everything between an element's opening and closing tags, though it has specific prerequisites about element nesting. Both parsers are configurable with options for handling XML comments, CDATA sections, and self-closing tags.

The project supports multiple input sources through different stream providers: File for reading XML files from disk, Stdin for CLI applications that receive XML through standard input, and Guzzle for streaming XML over HTTP. The library maintains backward compatibility with PHP 5.3 in older versions while supporting modern PHP 7.2 and above, making it accessible to projects across different PHP ecosystems. Installation is straightforward via Composer, and the library includes features like progress tracking callbacks and the ability to extract and access root elements during streaming.

Advertisement

Share this video