PHPackages                             pear/xml\_xrd - 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. pear/xml\_xrd

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

pear/xml\_xrd
=============

PHP library to parse and generate "Extensible Resource Descriptor (XRD) Version 1.0" files

v0.3.1(11y ago)17703[3 PRs](https://github.com/pear/XML_XRD/pulls)1LGPLPHP

Since Jul 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/pear/XML_XRD)[ Packagist](https://packagist.org/packages/pear/xml_xrd)[ RSS](/packages/pear-xml-xrd/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

XML\_XRD
========

[](#xml_xrd)

PHP library to parse and generate [Extensible Resource Descriptor (XRD) Version 1.0](http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html) files. It supports loading and saving XML (XRD) and JSON (JRD) markup.

XRD and JRD files are used for `.well-known/host-meta` files as standardized in [RFC 6415: Web Host Metadata](http://tools.ietf.org/html/rfc6415).

[Webfinger](http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-13), based on JRD, can be used to discover information about users by just their e-mail address, e.g. their OpenID provider URL.

The XRD format supercedes the XRDS format defined in XRI 2.0, which is used in the [Yadis communications protocol](http://yadis.org/).

Contents

- [Examples](#examples)
    - [Loading XRD files](#loading-xrd-files)
        - [Load from file](#load-from-file)
        - [Load from string](#load-from-string)
    - [Verification](#verification)
        - [Verify subject](#verify-subject)
    - [Link finding](#link-finding)
        - [Get all links](#get-all-links)
        - [Get link by relation](#get-link-by-relation)
        - [Get link by relation + optional type](#get-link-by-relation-optional-type)
        - [Get link by relation + type](#get-link-by-relation-type)
        - [Get all links by relation](#get-all-links-by-relation)
    - [Properties](#properties)
        - [Get a single property](#get-a-single-property)
        - [Get all properties](#get-all-properties)
        - [Get all properties of a type](#get-all-properties-of-a-type)
    - [Working with Links](#working-with-links)
        - [Accessing link attributes](#accessing-link-attributes)
        - [Additional link properties](#additional-link-properties)
    - [Generating XRD files](#generating-xrd-files)
        - [.well-known/host-meta](#well-known-host-meta)
        - [Webfinger file](#webfinger-file)
- [Error handling](#error-handling)
- [TODO](#todo)
- [Links](#links)

[Examples](#id13)
-----------------

[](#examples)

### [Loading XRD files](#id14)

[](#loading-xrd-files)

#### [Load from file](#id15)

[](#load-from-file)

```

 ...
XRD;

require_once 'XML/XRD.php';
$xrd = new XML_XRD();
try {
    $xrd->loadString($myxrd, 'xml');
} catch (XML_XRD_Exception $e) {
    die('Loading XRD string failed: '  . $e->getMessage());
}
```

### [Verification](#id17)

[](#verification)

#### [Verify subject](#id18)

[](#verify-subject)

Check if the XRD file really describes the resource/URL that we requested the XRD for:

```

```

If you want a JSON file for JRD:

```
echo $x->to('json');
```

#### [Webfinger file](#id34)

[](#webfinger-file)

```

```

[Error handling](#id35)
-----------------------

[](#error-handling)

When loading a file, exceptions of type `XML_XRD_Exception` may be thrown. All other parts of the code do not throw exceptions but fail gracefully by returning `null`, e.g. when a property does not exist.

Using `loadFile()` may result in PHP warnings like:

```
Warning: simplexml_load_file(https://example.org/) failed to open stream: Connection refused
```

This cannot be prevented properly, so you either have to silence it with `@`or fetch the file manually and use `loadString()`.

[TODO](#id36)
-------------

[](#todo)

- XML signature verification
- (very optional) XRDS (multiple XRD)?

[Links](#id37)
--------------

[](#links)

- [XRD 1.0 standard specification](http://docs.oasis-open.org/xri/xrd/v1.0/xrd-1.0.html)
- [OASIS XRI committee](http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xri)
- [WebFinger protocol draft](http://code.google.com/p/webfinger/wiki/WebFingerProtocol)
- [WebFinger: Common Link relations](http://code.google.com/p/webfinger/wiki/CommonLinkRelations)
- [More link relations](http://search.cpan.org/~tobyink/WWW-Finger-0.101/lib/WWW/Finger/Webfinger.pm)
- [RFC 5785: Defining Well-Known Uniform Resource Identifiers](http://tools.ietf.org/html/rfc5785)
- [RFC 6415: Web Host Metadata](http://tools.ietf.org/html/rfc6415)
- [WebFinger draft](http://tools.ietf.org/html/draft-ietf-appsawg-webfinger-13)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.1% 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

4323d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1323714f58f9144af310e5e4217e61b96ad7c42bc5c93a1f2d97deca95f6f4f8?d=identicon)[ashnazg](/maintainers/ashnazg)

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

---

Top Contributors

[![cweiske](https://avatars.githubusercontent.com/u/59036?v=4)](https://github.com/cweiske "cweiske (66 commits)")[![till](https://avatars.githubusercontent.com/u/27003?v=4)](https://github.com/till "till (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pear-xml-xrd/health.svg)

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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