All Projects → alex-oleshkevich → php-fast-xml-parser

alex-oleshkevich / php-fast-xml-parser

Licence: MIT license
Fast SAX XML parser for PHP.

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php-fast-xml-parser

gosax
gosax is a basic wrapper for stream parsing of XML (SAX) Go
Stars: ✭ 48 (+92%)
Mutual labels:  sax, sax-parser
attoparser
A tiny but fast java event-style markup parser.
Stars: ✭ 46 (+84%)
Mutual labels:  parsing, sax
python3-mal
Python interface to MyAnimeList
Stars: ✭ 18 (-28%)
Mutual labels:  parsing
rita-dsl
A Domain Specific Language (DSL) for building language patterns. These can be later compiled into spaCy patterns, pure regex, or any other format
Stars: ✭ 60 (+140%)
Mutual labels:  parsing
metal
A Java library for parsing binary data formats, using declarative descriptions.
Stars: ✭ 13 (-48%)
Mutual labels:  parsing
sexp-grammar
Invertible parsing for S-expressions
Stars: ✭ 28 (+12%)
Mutual labels:  parsing
ParsecSharp
The faster monadic parser combinator library for C#
Stars: ✭ 23 (-8%)
Mutual labels:  parsing
wasmbin
A self-generating WebAssembly parser & serializer in Rust.
Stars: ✭ 40 (+60%)
Mutual labels:  parsing
Ramble
A R parser based on combinatory parsers.
Stars: ✭ 19 (-24%)
Mutual labels:  parsing
re-typescript
An opinionated attempt at finally solving typescript interop for ReasonML / OCaml.
Stars: ✭ 68 (+172%)
Mutual labels:  parsing
codeparser
Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
Stars: ✭ 84 (+236%)
Mutual labels:  parsing
floaxie
Floating point printing and parsing library based on Grisu2 and Krosh algorithms
Stars: ✭ 28 (+12%)
Mutual labels:  parsing
pysub-parser
Library for extracting text and timestamps from multiple subtitle files (.ass, .ssa, .srt, .sub, .txt).
Stars: ✭ 40 (+60%)
Mutual labels:  parsing
cmake-reflection-template
A template for simple C++ reflection done with CMake and Python (no other external tools)
Stars: ✭ 37 (+48%)
Mutual labels:  parsing
extract-emails
Extract emails from a given website
Stars: ✭ 58 (+132%)
Mutual labels:  parsing
abnf parsec
ABNF in, parser out
Stars: ✭ 42 (+68%)
Mutual labels:  parsing
microformats-ruby
Ruby gem that parse HTML containing microformats/microformats2 and returns Ruby objects, a Ruby hash or a JSON hash
Stars: ✭ 89 (+256%)
Mutual labels:  parsing
pypact
A Python package for parsing FISPACT-II output
Stars: ✭ 19 (-24%)
Mutual labels:  parsing
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (-32%)
Mutual labels:  parsing
parser-lang
A parser combinator library with declarative superpowers
Stars: ✭ 25 (+0%)
Mutual labels:  parsing

PHP Fast XML Parser

PHP Fast XML Parser is a PHP library for parsing large XML files using PHP. Key features:

  • Lightweight;
  • Flexible (result can be easily managed via callback handlers);
  • Good for memory critical projects (~10Mb in average while parsing 500mb XML file)

Build Status

Example & Tutorial

// create callback handler
$handler = new GenericHandler;

// set "on item parsed" callback
$handler->setOnItemParsedCallback(function ($item) use ($self) {
    // do smth with parsed item
});

// set "on progress" callback
$handler->setOnProgressCallback(function ($bytesProcessed, $bytesTotal) use ($self) {
    // eg. draw a progress bar
});

// instantiate
$parser = new Parser($handler);

// define tags which you don't want to include in resulting array (optional)
$parser->setIgnoreTags(['root']);

// define end tag for every item
// (this is used as marker to determine when XML
// item was processed.
// For example, if you want to extract "value" from this XML source
//<root>
//    <value>VALUE</value>
//    <value>VALUE</value>
//    <value>VALUE</value>
//</root>
// you must call $parser->setEndTag('value') so library can
// emit content of every <value /> tag in "onItemParsed" event.
$parser->setEndTag('value');

// run
$parser->parse('bigfile.xml');
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].