PHPackages                             brunty/relax-ng-domdocument - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. brunty/relax-ng-domdocument

AbandonedArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

brunty/relax-ng-domdocument
===========================

Adds a convenience feature to DOMDocument::relaxNGValidate and DOMDocument::relaxNGValidateSource to disable PHP Warnings

0.2(9y ago)11272MITPHP

Since Jan 18Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Brunty/php-relax-ng-domdocument)[ Packagist](https://packagist.org/packages/brunty/relax-ng-domdocument)[ RSS](/packages/brunty-relax-ng-domdocument/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Brunty\\DOMDocument
===================

[](#bruntydomdocument)

[![Build Status](https://camo.githubusercontent.com/656462e201acd41dae02b09424ffc8a6d417e328d6c10a2587d64e9e476acf04/68747470733a2f2f7472617669732d63692e6f72672f4272756e74792f7068702d72656c61782d6e672d646f6d646f63756d656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Brunty/php-relax-ng-domdocument)

This class is just a little helper to remove error handling when using `DOMDocument::relaxNGValidate` and `DOMDocument::relaxNGValidateSource` as by default, PHP warnings are generated when validation fails.

Compatibility
-------------

[](#compatibility)

- PHP 5.6 and above

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

[](#installation)

`composer require brunty/relax-ng-domdocument`

Usage
-----

[](#usage)

The class extents `\DOMDocument` and the method calls are compatible with the parent class.

```
$document = new \Brunty\DOMDocument;
$document->load('my-file.xml');

$result = $document->relaxNGValidate('my-schema.rng');
// or
$result = $document->relaxNGValidateSource(file_get_contents('my-schema.rng'));

// $result will be true / false depending on whether the document validated
```

You can get the warnings that came up during validation by using the `getValidationWarnings()` method, it'll return an array of the warning messages generated.

```
$document = new \Brunty\DOMDocument;
$document->load('my-invalid-file.xml');

$result = $document->relaxNGValidate('my-schema.rng');

$warnings = $document->getValidationWarnings();
```

Contributing
------------

[](#contributing)

Although this project is small, openness and inclusivity are taken seriously. To that end the following code of conduct has been adopted.

[Contributor Code of Conduct](CONTRIBUTING.md)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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 ~1 days

Total

2

Last Release

3396d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/40cdb90b0420d70582f27d22c873198f24f2704ee3f80227134a7180cf8cff51?d=identicon)[Brunty](/maintainers/Brunty)

---

Top Contributors

[![Brunty](https://avatars.githubusercontent.com/u/1573273?v=4)](https://github.com/Brunty "Brunty (6 commits)")

---

Tags

schemavalidationxmldomdocumentRELAX NGRELAXNG

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/brunty-relax-ng-domdocument/health.svg)

```
[![Health](https://phpackages.com/badges/brunty-relax-ng-domdocument/health.svg)](https://phpackages.com/packages/brunty-relax-ng-domdocument)
```

###  Alternatives

[opis/json-schema

Json Schema Validator for PHP

64236.9M185](/packages/opis-json-schema)[romaricdrigon/metayaml

Using \[Yaml|Xml|json\] schemas files to validate \[Yaml|Xml|json\]

103306.5k8](/packages/romaricdrigon-metayaml)[evaisse/php-json-schema-generator

A JSON Schema Generator.

20298.5k1](/packages/evaisse-php-json-schema-generator)[eclipxe/xmlschemavalidator

PHP Library for XML Schema Validations

14300.9k9](/packages/eclipxe-xmlschemavalidator)[romegasoftware/laravel-schema-generator

Generate TypeScript Zod validation schemas from Laravel validation rules

288.2k](/packages/romegasoftware-laravel-schema-generator)

PHPackages © 2026

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