PHPackages                             dadyday/xparse - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. dadyday/xparse

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

dadyday/xparse
==============

Helper to parse html data into a struct

v0.1.1(4y ago)018HTML

Since Sep 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dadyday/xparse)[ Packagist](https://packagist.org/packages/dadyday/xparse)[ RSS](/packages/dadyday-xparse/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Xparse
======

[](#xparse)

A small lib, to parse XML or HTML details with XPath expressions into a PHP array structure.

Installation
------------

[](#installation)

```
$ composer require dadyday/xparse
```

Usage
-----

[](#usage)

We create the scheme first (maybe in a DI container), and parse the document within our business logic.

```
 Value::str('@attr', function($val) {
            # val is null if not found
            return ($val ?? 'not') . ' found';
        }),
        # all textnodes in the current context
        'text' => '.', # short for Value::str('...')
        # returns the existence as a boolean
        'next' => Value::bool('following-sibling::el'),
        # return a list of 2. arg within each finding of the first
        'prev' => Value::list('preceding-sibling::el', '@id'),
    ]
);
$oParser = new Parser($oValue);
$aList = $oParser->parseXml($xml);
$aList == [ // map for every el
    // key is first i-content as integer
    1 => [ // struct for first el
        'attr' => 'an attrib found', // attr of first el
        'text' => 'the important and 1st content', // text content
        'next' => true, // there are following el's
        'prev' => [], // no previous el
    ],
    // key from b-content
    2 => [ // secound el
        'attr' => 'not found', // there is no attrib
        'text' => '2. content',
        'next' => true,
        'prev' => ['a'], // one el before
    ],
    // key is the default 'none'
    'none' => [ // third el
        'attr' => 'another attrib found',
        'text' => '3rd content',
        'next' => false, // no el behind
        'prev' => ['a', 'b'], // two el's before
    ],
];
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1709d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64a2cf4c4383bd97a5d17276b982e1639dc4b4e63723146a5ba240976695eb3f?d=identicon)[dadyday](/maintainers/dadyday)

---

Top Contributors

[![dadyday](https://avatars.githubusercontent.com/u/1249773?v=4)](https://github.com/dadyday "dadyday (3 commits)")

### Embed Badge

![Health badge](/badges/dadyday-xparse/health.svg)

```
[![Health](https://phpackages.com/badges/dadyday-xparse/health.svg)](https://phpackages.com/packages/dadyday-xparse)
```

###  Alternatives

[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k230.0M284](/packages/opis-closure)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[michelf/php-markdown

PHP Markdown

3.5k52.4M345](/packages/michelf-php-markdown)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
