PHPackages                             stagerightlabs/phpxdr - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. stagerightlabs/phpxdr

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

stagerightlabs/phpxdr
=====================

Encode and Decode XDR strings with PHP

0.01.01(2y ago)05.1kApache-2.0PHP

Since Nov 13Pushed 2y ago1 watchersCompare

[ Source](https://github.com/stagerightlabs/phpxdr)[ Packagist](https://packagist.org/packages/stagerightlabs/phpxdr)[ Docs](https://github.com/stagerightlabs/phpxdr)[ RSS](/packages/stagerightlabs-phpxdr/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelogDependencies (5)Versions (19)Used By (0)

[![Read and Write XDR with PHP](https://camo.githubusercontent.com/1735badf53c60150aea1bde0307faa5f0e698ce9780836886f7c0ac6790496bf/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5048505844522e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d737461676572696768746c616273253246706870786472267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d526561642b616e642b77726974652b5844522b776974682b504850266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d6265616b6572)](https://camo.githubusercontent.com/1735badf53c60150aea1bde0307faa5f0e698ce9780836886f7c0ac6790496bf/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f5048505844522e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d737461676572696768746c616273253246706870786472267061747465726e3d776967676c65267374796c653d7374796c655f31266465736372697074696f6e3d526561642b616e642b77726974652b5844522b776974682b504850266d643d312673686f7757617465726d61726b3d3126666f6e7453697a653d313030707826696d616765733d6265616b6572)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b7bfa1312bffc15b76a55074716dc192addc9df1274264a9bedb77c25017dd7c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737461676572696768746c6162732f7068707864722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stagerightlabs/phpxdr)[![Total Downloads](https://camo.githubusercontent.com/2e9534e54fdb0d8cfdcff9b473ed973ffe13f0bf86d20ba399a3fd1c9c19ea34/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f737461676572696768746c6162732f7068707864722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/stagerightlabs/phpxdr)[![GitHub Actions](https://github.com/stagerightlabs/phpxdr/actions/workflows/main.yml/badge.svg)](https://github.com/stagerightlabs/phpxdr/actions/workflows/main.yml/badge.svg)

This package provides an implementation of the [RFC 4506](https://datatracker.ietf.org/doc/html/rfc4506.html) External Data Representation standard for PHP. It is built to be extensible; you can encode and decode custom data objects as well as primitive generics.

This package is currently in beta; the API is still subject to change.

Important Note: [Quadruple-Precision Floating-Point](https://datatracker.ietf.org/doc/html/rfc4506.html#section-4.8) numbers are not supported by this package as a native type. However tools are provided for you to implement this in your own project should you have the need.

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

[](#installation)

You can install the package via composer:

```
composer require stagerightlabs/phpxdr
```

Usage
-----

[](#usage)

```
use StageRightLabs\PhpXdr\XDR;

// Encode
$xdr = XDR::fresh()
    ->write(42, XDR::INT)
    ->write(3.14, XDR::FLOAT)
    ->write('Bad Wolf', XDR::STRING);

$payload = $xdr->asBase64(); // AAAAKkBI9cMAAAAIQmFkIFdvbGY=

// Decode
$xdr = XDR::fromBase64('AAAAKkBI9cMAAAAIQmFkIFdvbGY=');
$int = $xdr->read(XDR::INT); // 42
$float = $xdr->read(XDR::FLOAT); // ~3.14
$string = $xdr->read(XDR::STRING); // 'Bad Wolf'
```

More implementation and usage details can be [found in the wiki](https://github.com/stagerightlabs/phpxdr/wiki).

### Testing

[](#testing)

```
./vendor/bin/phpunit
```

### Credits

[](#credits)

This package draws a lot of inspiration from both [zulucrypto/stellar-api](https://github.com/zulucrypto/stellar-api) and [stellar/js-xdr](https://github.com/stellar/js-xdr).

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

The Apache License 2. Please see [License File](LICENSE.md) for more information.

PHP Package Boilerplate
-----------------------

[](#php-package-boilerplate)

This package was generated using the [PHP Package Boilerplate](https://laravelpackageboilerplate.com) by [Beyond Code](http://beyondco.de/).

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Recently: every ~163 days

Total

17

Last Release

918d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/97d8f58fda6a474519e876ece356e8246390e4e7f3b2c56ee8ec6bc1e88cfa6b?d=identicon)[Stage Right Labs](/maintainers/Stage%20Right%20Labs)

---

Top Contributors

[![rydurham](https://avatars.githubusercontent.com/u/674347?v=4)](https://github.com/rydurham "rydurham (64 commits)")

---

Tags

phprfc-4506xdrXDRRFC-4506

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/stagerightlabs-phpxdr/health.svg)

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

###  Alternatives

[pocketmine/pocketmine-mp

A server software for Minecraft: Bedrock Edition written in PHP

3.5k74.6k86](/packages/pocketmine-pocketmine-mp)[godruoyi/php-snowflake

An ID Generator for PHP based on Snowflake Algorithm (Twitter announced).

8582.3M61](/packages/godruoyi-php-snowflake)[bitwasp/bitcoin

PHP Bitcoin library with functions for transactions, signatures, serialization, Random/Deterministic ECDSA keys, blocks, RPC bindings

1.1k533.2k43](/packages/bitwasp-bitcoin)[bitwasp/buffertools

Toolbox for working with binary and hex data. Similar to NodeJS Buffer.

65764.4k41](/packages/bitwasp-buffertools)[pocketmine/math

PHP library containing math related code used in PocketMine-MP

45573.2k14](/packages/pocketmine-math)[pocketmine/nbt

PHP library for working with Named Binary Tags

42574.4k13](/packages/pocketmine-nbt)

PHPackages © 2026

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