prewk/xml-string-streamer-guzzle

Stream provider for Guzzle for use with xml-string-streamer

1.2.1 2021-09-07 18:30 UTC

README

Use with xml-string-streamer

What is it?

Streams large XML files with low memory consumption, over HTTP using Guzzle.

Installing

Run composer require prewk/xml-string-streamer-guzzle to install this package.

Examples

use Prewk\XmlStringStreamer;
use Prewk\XmlStringStreamer\Stream;
use Prewk\XmlStringStreamer\Parser;

$url = "http://example.com/really-large-xml-file.xml";

$CHUNK_SIZE = 1024;
$stream = new Stream\Guzzle($url, $CHUNK_SIZE);
$parser = new Parser\StringWalker();

$streamer = new XmlStringStreamer($parser, $stream);

while ($node = $streamer->getNode()) {
	// ...
}

For more info, see the xml-string-streamer repo.

Compatibility

  • For PHP >= 5.5 with Guzzle 6 compatibility, use version 0.4.0
  • For PHP >= 7.2 with Guzzle 7 compatibility, use latest (1.0.0 and onwards)