PHPackages                             werd/xml-xpath-validation - 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. werd/xml-xpath-validation

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

werd/xml-xpath-validation
=========================

XML XPath based validation

1.2.0(10y ago)019MITPHPPHP &gt;=5.5

Since Jun 14Pushed 3y agoCompare

[ Source](https://github.com/werdlv/xml-xpath-validation)[ Packagist](https://packagist.org/packages/werd/xml-xpath-validation)[ RSS](/packages/werd-xml-xpath-validation/feed)WikiDiscussions master Synced 1mo ago

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

xml-xpath-validation
====================

[](#xml-xpath-validation)

XML XPath based validation

[![Latest Stable Version](https://camo.githubusercontent.com/6280de5f43bb63ac1c2fe0518d2a913025d296efc6be55c8bebf6fece692073a/68747470733a2f2f706f7365722e707567782e6f72672f776572642f786d6c2d78706174682d76616c69646174696f6e2f762f737461626c65)](https://packagist.org/packages/werd/xml-xpath-validation)[![Build Status](https://camo.githubusercontent.com/05ca0575609c49bf95dfb99cbdfcb12427db32a3a89d1fbaf673edf73d0bb28e/68747470733a2f2f7472617669732d63692e6f72672f776572646c762f786d6c2d78706174682d76616c69646174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/werdlv/xml-xpath-validation)[![Coverage Status](https://camo.githubusercontent.com/0aec46a3886ee1a83b1adc1f19858a8c14b76ee9f33bce7a604dc9a5f0b8243f/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f776572646c762f786d6c2d78706174682d76616c69646174696f6e2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/werdlv/xml-xpath-validation?branch=master)[![Dependency Status](https://camo.githubusercontent.com/680ed7cc17dc8ad63716a8205e4940837d0b8ba36a2d213db440a965ca6d66d6/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f776572643a786d6c2d78706174682d76616c69646174696f6e2f6465762d6d61737465722f6261646765)](https://www.versioneye.com/php/werd:xml-xpath-validation/dev-master)[![License](https://camo.githubusercontent.com/10b6c244352754ed477603879d0eaf38c776f83b40927bd554ced8a711e1d830/68747470733a2f2f706f7365722e707567782e6f72672f776572642f786d6c2d78706174682d76616c69646174696f6e2f6c6963656e7365)](https://packagist.org/packages/werd/xml-xpath-validation)

Features
--------

[](#features)

- Regex based validation with element count validation
- Compatible with PHP &gt;= 5.5 and [HHVM](http://hhvm.com/)

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

[](#installation)

Through [Composer](https://getcomposer.org/):

```
$ composer require werd/xml-xpath-validation

```

Usage
-----

[](#usage)

```
use Werd\XmlXpathValidation\Validator;
use Werd\XmlXpathValidation\RulableInterface;

class MyRules implements RulableInterface
{
    public function getRules()
    {
        return [
            [
                'xpath' => '//my-node/@my-attribute',
                'regex' => self::REGEX_INTEGER
            ],
            [
                'xpath' => '//my-node/sub-node',
                'regex' => '/^some-custom:+[a-z]+$/i',
            ],
            ...
        ];
    }
}

$myRules = new MyRules();
$validator = new Validator();
$result = $validator->validate($pathToXml, $myRules->getRules());
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

3891d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.6

1.2.0PHP &gt;=5.5

### Community

Maintainers

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

---

Top Contributors

[![jsakars](https://avatars.githubusercontent.com/u/1607778?v=4)](https://github.com/jsakars "jsakars (37 commits)")

---

Tags

validationxmlXpath

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/werd-xml-xpath-validation/health.svg)

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

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k489.6M672](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k148.7M416](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M383](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

64736.9M186](/packages/opis-json-schema)[romaricdrigon/metayaml

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

103306.5k8](/packages/romaricdrigon-metayaml)

PHPackages © 2026

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