PHPackages                             lightools/xml - 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. lightools/xml

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

lightools/xml
=============

Simple and safe parsing of XML and HTML sources.

v3.0.0(5y ago)10123.5k—3.4%24MITPHPPHP &gt;=8.0CI passing

Since Mar 21Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/lightools/xml)[ Packagist](https://packagist.org/packages/lightools/xml)[ RSS](/packages/lightools-xml/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (5)Versions (11)Used By (4)

Introduction
------------

[](#introduction)

This library provides simple interface for loading XML or HTML strings to DomDocument object. It prevents some known vulnerabilities and allows you to handle LibXML errors simply by catching XmlException as you can see below.

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

[](#installation)

```
$ composer require lightools/xml
```

Simple usage
------------

[](#simple-usage)

Both loading methods (loadXml and loadHtml) return DomDocument. If you prefer working with SimpleXmlElement, you can use [simplexml\_import\_dom](https://secure.php.net/manual/en/function.simplexml-import-dom.php) function.

```
$xml = 'text';
$html = 'Foo';

$loader = new Lightools\Xml\XmlLoader();

try {
    $xmlDomDocument = $loader->loadXml($xml);
    $htmlDomDocument = $loader->loadHtml($html);

} catch (Lightools\Xml\XmlException $e) {
    // process exception
}
```

How to run checks
-----------------

[](#how-to-run-checks)

```
$ composer check
```

Versions
--------

[](#versions)

- v1.x is for PHP 5.4 and higher
- v2.x is for PHP 7.1 and higher
- v3.x is for PHP 8.0 and higher

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance54

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 55.3% 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 ~329 days

Recently: every ~414 days

Total

7

Last Release

1827d ago

Major Versions

v1.0.x-dev → v2.0.02017-02-05

v2.0.x-dev → v3.0.02021-08-18

PHP version history (3 changes)v1.0.0PHP &gt;=5.4

v2.0.0PHP &gt;=7.1

v3.0.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b545e3f9d982d538f11bc42b3dc2d186f706cef92c8bc8bc8f8788b08186ea5?d=identicon)[janedbal](/maintainers/janedbal)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (21 commits)")[![janedbal](https://avatars.githubusercontent.com/u/1993453?v=4)](https://github.com/janedbal "janedbal (17 commits)")

---

Tags

domdocumenthtmlxml

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lightools-xml/health.svg)

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

###  Alternatives

[mwgg/airports

A JSON collection of ~29k entries with basic information about nearly every airport and landing strip in the world

7683.4k](/packages/mwgg-airports)[sauladam/shipment-tracker

Parses tracking information for several carriers, like UPS, USPS, DHL and GLS by simply scraping the data. No need for any kind of API access.

9845.4k](/packages/sauladam-shipment-tracker)[glauberportella/cnab-layouts-parser

Parser de arquivos de configuração CNAB gerados no projeto https://github.com/glauberportella/cnab-layouts

2154.5k](/packages/glauberportella-cnab-layouts-parser)[tcds-io/php-jackson

A lightweight, flexible object serializer for PHP, inspired by FasterXML/jackson

113.4k10](/packages/tcds-io-php-jackson)

PHPackages © 2026

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