Download the PHP package nvashenko/xml-streamer without Composer

On this page you can find all versions of the php package nvashenko/xml-streamer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package xml-streamer

TBPixel/XMLStreamer

Latest Version on Packagist Build Status

Content

Installation

You can install this package via composer:

Purpose

I found myself in need of a way to work with large XML data efficiently. The built in XMLReader PHP provides is fast and efficient, but can be a pain to work with at times. I wanted a dependency-free way to stream XML data and work with it using my provided classmap.

This package attempts to alleviate some of the headache of working with XMLReader, while also providing a collection of PSR-7 compatible XML streams. It offers a convenient way to iterate large XML data sets for reduced memory usage.

The optional client is also provided to allow for casting XML Strings to classmap objects.

Examples

Say we had an XML file called users.xml with the following data:

With this package, we can simply create a new Client, pass it a PSR-7 compatible stream, and work with our data using our types.

We can also loop the client directly, as it implements the IteratorAggregate interface.

Iteration Depth

ReaderStream, the underlying XMLReader wrapper for the stream implementations found in this package, contains a final constructor argument called $depth. This is an integer (default to 0) or string which represents a depth to start iterating records found in an XML document.

The string can be the name of an XML tag, allowing the stream to iterate until it finds the tag rather than having to know the depth in advance.

Given the same data as above, we could rewrite our code snippet as follows:

The previous value of 1 was acceptable for iterating this result set, but if the data was wrapped an arbitrary number of levels deep then this tag-name approach becomes convenient.

Automatic Casting

If we had a user which implemented the required CreateFromSimpleXML interface, we could also cast the SimpleXMLElement as we iterate for easier access.

Now when we create our client, lets just pass the FQCN to the clients classmap and casting will be automated.

The clients second argument is an array of key value pairs mapping the XML element names to the FQCN.

Extending

Both the client and the streams are built ontop of PSR-7's Psr\Http\Message\StreamInterface, meaning it should be possible for you to swap out the stream with your own implementation. If you plan to use XMLReader but want a different resource handler, the TBPixel\XMLStreamer\ReaderStream is an abstract implementation which expects to process XML streams via XMLReader and handles most functionality well.

Contributing

Please see CONTRIBUTING for details.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Support Me

Hi! I'm a developer living in Vancouver, BC and boy is the housing market tough. If you wanna support me, consider following me on Twitter @TBPixel, or consider buying me a coffee.

License

The MIT License (MIT). Please see License File for more information.


All versions of xml-streamer with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
psr/http-message Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nvashenko/xml-streamer contains the following files

Loading the files please wait ....