PHPackages                             mihas2/xml\_validator - 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. mihas2/xml\_validator

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

mihas2/xml\_validator
=====================

A simple PHP XML validator for large XML files

1.1.1(2y ago)0100MITPHPPHP &gt;=8.1

Since Feb 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mihas2/xml_validator)[ Packagist](https://packagist.org/packages/mihas2/xml_validator)[ Docs](https://github.com/mihas2/xml_validator)[ RSS](/packages/mihas2-xml-validator/feed)WikiDiscussions master Synced 1mo ago

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

XML Validator Library
=====================

[](#xml-validator-library)

A simple PHP XML validator for validate large XML files.

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

[](#installation)

To install this library, use Composer:

```
composer require mihas2/xml_validator
```

Usage
-----

[](#usage)

Here's an example of how to use the XML validator:

```
use mihas2\XmlValidator\XmlValidator;

$xmlFile = 'path/to/your/xml/file.xml';
$xmlFileValidator = new XmlValidator($xmlFile);

if ($xmlFileValidator->validate()) {
    echo "XML file is valid.";
} else {
    foreach ($xmlFileValidator->getErrors() as $error) {
        printf("Line: %d, Column: %d, Message: %s\n", $error->lineNumber, $error->columnNumber, $error->message);
    }
}
```

```
use mihas2\XmlValidator\XmlValidator;

$xmlUrl = 'https://www.yourdomain.com/validateme.xml';
$xmlUrlValidator = new XmlValidator($xmlUrl);

if ($xmlUrlValidator->validate()) {
    echo "XML file is valid.";
} else {
    foreach ($xmlUrlValidator->getErrors() as $error) {
        printf("Line: %d, Column: %d, Message: %s\n", $error->lineNumber, $error->columnNumber, $error->message);
    }
}
```

Configuration
-------------

[](#configuration)

You can configure the XML validator with these options:

- `$xmlFile` (required): The path to your XML file.
- `$verifyPeer` (optional, default `false`): Set to true to verify the SSL/TLS certificate of the remote schema location.
- `$verifyPeerName` (optional, default `false`): Set to true to verify that the hostname matches the certificate's subject.
- `$maxDepth` (optional, default `10000`): The maximum depth for XML elements during validation.
- `$xmlFlags` (optional, default `LIBXML_BIGLINES | LIBXML_PARSEHUGE`): Additional flags to configure the libxml library's behavior.

Testing
-------

[](#testing)

To run tests, execute this command:

```
composer test
```

**Not implemented yet**

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

[](#contributing)

We welcome contributions! Please submit a pull request with your proposed changes and describe what they do in detail.

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

```

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

3

Last Release

829d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/acec0245ca2b6f1fcb205a06ac30dc877e393aabe6e7be6ed8f83a1944d0da68?d=identicon)[mihas2](/maintainers/mihas2)

---

Top Contributors

[![mihas2](https://avatars.githubusercontent.com/u/25888437?v=4)](https://github.com/mihas2 "mihas2 (1 commits)")

---

Tags

urlphpvalidatorxmlfileslarge

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[runz0rd/mapper-php

Model mapping, unmapping and validation

17451.9k2](/packages/runz0rd-mapper-php)

PHPackages © 2026

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