PHPackages                             alcamo/xpointer - 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. alcamo/xpointer

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

alcamo/xpointer
===============

Implementation of XPointer framework with xmlns() and xpointer() schemes

0.8.1(6mo ago)12641Apache-2.0PHPPHP 7.3 - 8.0

Since Jun 30Pushed 6mo ago1 watchersCompare

[ Source](https://github.com/rv1971/alcamo-xpointer)[ Packagist](https://packagist.org/packages/alcamo/xpointer)[ RSS](/packages/alcamo-xpointer/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (14)Used By (1)

Usage example
=============

[](#usage-example)

```
use alcamo\xpointer\Pointer;

$doc = new \DOMDocument();

```

... load something into the document ...

```
$urlFragment = 'xmlns(f=http://foo.example.org) xpointer(/*/f:bar[42])';

$pointer = new Pointer($urlFragment);

```

The following evaluates the XPath `/*/f:bar[42]` on the document, where the prefix `f` is registered as the namespace `http://foo.example.org`:

```
$bar = $pointer->process($doc);

```

Supplied interfaces and classes
===============================

[](#supplied-interfaces-and-classes)

Interface `PointerInterface`
----------------------------

[](#interface-pointerinterface)

Simple interface for classes that implement a [Pointer](https://www.w3.org/TR/xptr-framework/#dt-pointer). Requires a static factory method to create a Pointer from an URL fragment string and a method to process the pointer on a DOM document.

Class `Pointer`
---------------

[](#class-pointer)

Implementation of `PointerInterface` supporting [Shorthand Pointers](https://www.w3.org/TR/xptr-framework/#shorthand) as well as the [XPointer xmlns() Scheme](https://www.w3.org/TR/xptr-xmlns/) and [XPointer xpointer() Scheme](https://www.w3.org/TR/xptr-xpointer/).

Interface `PartInterface`
-------------------------

[](#interface-partinterface)

Simple interface for classes that implement a [Pointer part](https://www.w3.org/TR/xptr-framework/#dt-pointerpart). Requires just a `process()` method to process the [Scheme data](https://www.w3.org/TR/xptr-framework/#syntax). Processing of parts stops as soon as this method return a non-`null` value.

Class `XmlnsPart`
-----------------

[](#class-xmlnspart)

Implementation of `PartInterface` for the [XPointer xmlns() Scheme](https://www.w3.org/TR/xptr-xmlns/). The `process()` method modifies the namespace bindings as described in the specification.

Class `XpointerPart`
--------------------

[](#class-xpointerpart)

Implementation of `PartInterface` for the [XPointer xpointer() Scheme](https://www.w3.org/TR/xptr-xpointer/). The `process()` method returns the result of XPath evaluation, if successful.

Extending this package
======================

[](#extending-this-package)

To add other XPointer schemes:

1. Write a new pointer part class that implements `PartInterface`.
2. Write a class derived from `Pointer` and add your new pointer part class to the class constant `SCHEME_MAP`.

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance66

Regular maintenance activity

Popularity18

Limited adoption so far

Community11

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

Recently: every ~250 days

Total

13

Last Release

207d ago

PHP version history (2 changes)0.1PHP 7.3 - 7.4

0.1.1PHP 7.3 - 8.0

### Community

Maintainers

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

---

Top Contributors

[![rv1971](https://avatars.githubusercontent.com/u/39520256?v=4)](https://github.com/rv1971 "rv1971 (17 commits)")

---

Tags

xmldomxpointer

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/alcamo-xpointer/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabre/xml

sabre/xml is an XML library that you may not hate.

52832.2M131](/packages/sabre-xml)[veewee/xml

XML without worries

1835.9M29](/packages/veewee-xml)[fluentdom/fluentdom

A fluent api for the php dom extension.

337306.9k17](/packages/fluentdom-fluentdom)[rct567/dom-query

DomQuery is a PHP library that allows easy 'jQuery like' DOM traversing and manipulation

134261.0k4](/packages/rct567-dom-query)[benmorel/xml-streamer

Stream large XML files as DOM nodes with low memory consumption

1649.5k](/packages/benmorel-xml-streamer)

PHPackages © 2026

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