PHPackages                             joeycumines/simple-xml-util - 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. joeycumines/simple-xml-util

ActiveLibrary

joeycumines/simple-xml-util
===========================

Utilities to improve maintainability of code that relies on PHP's simplexml\_load\_string.

v1.0.0-alpha(8y ago)05.3kApache-2.0PHPPHP &gt;=5.6

Since Dec 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/joeycumines/simple-xml-util)[ Packagist](https://packagist.org/packages/joeycumines/simple-xml-util)[ RSS](/packages/joeycumines-simple-xml-util/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

simple-xml-util
===============

[](#simple-xml-util)

Utilities to improve maintainability of code that relies on PHP's simplexml\_load\_string.

Features
--------

[](#features)

- Interface for better dependency injection
- Automatically manage internal errors, builds readable error string
- Makes it possible to use exception handling
- Configure `simplexml_load_string`, `libxml_use_internal_errors` and `libxml_disable_entity_loader`, without it feeling like you are relying on globals with side effects

Example
-------

[](#example)

```
// manual configuration example

use JoeyCumines\SimpleXmlUtil\Parser\SimpleXmlStringParser;

// ...

$xmlParser = new SimpleXmlStringParser($className, $options, $ns, $prefix, $disableEntityLoader);

// or

$xmlParser = (new SimpleXmlStringParser())
    ->setClassName($className)
    ->setOptions($options)
    ->setNs($ns)
    ->setPrefix($prefix)
    ->setDisableEntityLoader($disableEntityLoader);

// use the interface in the service - pre-configured

use JoeyCumines\SimpleXmlUtil\Exception\SimpleXmlStringParserException;
use JoeyCumines\SimpleXmlUtil\Interfaces\SimpleXmlStringParserInterface;

// ...

class SomeService
{
    private $xmlParser;
    private $logger;

    public function __construct(
        SimpleXmlStringParserInterface $xmlParser,
        Logger $logger
    ) {
        $this->xmlParser = $xmlParser;
        $this->logger = $logger;
    }

    public function doSomeXmlParsing(string $data): array
    {
        try {
            $doc = $this->xmlParser->parseXmlString($data);
        } catch (SimpleXmlStringParserException $e) {
            // the actual parser error will come through in the logs
            $this->logger->error(
                "[SomeService] o no our xml things failed:\n{$e}",
                $e
            );

            throw $e;
        }

        // at this point you can always be sure $doc is an actual object

        foreach ($doc as $name => $child) {
            // ...
        }

        // ...
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

3081d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48d8579005c43d4231f142cd657eda485ef219d5d95f3c7fbf2c8cdb7c7f9c93?d=identicon)[joeycumines](/maintainers/joeycumines)

---

Top Contributors

[![joeycumines](https://avatars.githubusercontent.com/u/7874540?v=4)](https://github.com/joeycumines "joeycumines (23 commits)")

### Embed Badge

![Health badge](/badges/joeycumines-simple-xml-util/health.svg)

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

PHPackages © 2026

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