Skip to content

tursander/XML-Parser-in-PHP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PHP XML Parser

A PHP XML parser script that provides an easy way to convert XML into native PHP arrays. It has no dependencies on any external libraries or extensions bundled with PHP. The entire parser is concisely written in PHP.

This project is actively maintained. If you spot an issue, please let me know through the Issues section on our Github project page: https://github.com/tursander/XML-Parser-in-PHP/issues

Why

As XML becomes less popular, the need for a parser moves from constant to infrequent. It makes little sense to keep a parser resident in memory at all times for functionality that might be used once every few days.

For example, just to get SimpleXML going, you will need to have the libxml2 library installed on your system. You will need xml, libxml, and simplexml extensions installed for PHP. You will need to keep all those extensions in memory for each request.

In contrast, this simple parser is less than 500 lines of code and is only loaded when you need it. It has no dependencies, no required libraries or extensions, and will work on any modern PHP installation. The price you pay for that convenience is speed. It is much slower than SimpleXML. See the benchmarking section for details.

In short, this project makes sense for those who want to simplify their PHP install and use, have a need for a simple XML parser, but don't much care about speed.

Requirements

PHP 5.4.0+

Install

Just place the countries.xml and index.php files in a convenient location.

Tests

None, for now.

Authors

See also the list of contributors who participated in all these projects.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Releases

No releases published

Packages

No packages published

Languages