PHPackages                             elis/xpub - 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. elis/xpub

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

elis/xpub
=========

A simple class to derive BTC and ETH extended public keys and addresses without GMP.

0446PHP

Since Mar 14Pushed 5y agoCompare

[ Source](https://github.com/elis-k/php-xpub)[ Packagist](https://packagist.org/packages/elis/xpub)[ RSS](/packages/elis-xpub/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

XPub
====

[](#xpub)

A simple class to derive address and extended public keys.

Coins supported:

- Bitcoin (Bitcoin Cash/Bitcoin SV)
- Ethereum (Binance Smart Chain)
- Tron
- Binance Chain

Supports `xpub`, `tpub`, `zpub` and `vpub` public key formats.

### Install

[](#install)

`composer require elis/xpub`

### Requirements

[](#requirements)

- PHP &gt;= 7.1
- BCMath or GMP extension

Usage
-----

[](#usage)

```
# PSR-4 autoloading with composer
use Elis\XPub;

# Create an XPub class instance from an xpub/tpub/zpub/vpub string.
$xpub = XPub::fromString( '' ); // => BIP44 Original
$xpub = XPub::fromString( '' ); // => BIP84 Native SegWit
# You can also specify the address scheme.
$xpub = XPub::fromString( '', XPub::BIP84 );
$xpub = XPub::fromString( '', XPub::BIP44 );

# Derive a child extended public key from it.
$xpub_i = $xpub->derive( $i );
# You can also pass an array to derive a path.
$xpub_i_k = $xpub->derive( [$i, $k]);

# An XPub can be serialized back into a string.
# Pass $asHex = true to serialize into a HEX string, base58 is the default.
$xpub_string = $xpub_i->toString( $asHex = false );

# An XPub can be converted into an address.
# Pass $coin = 'eth' to convert into an ETH address.
# (xpubs are converted into regular addresses, zpubs are converted into segwit addresses.)
$address = $xpub_i->toAddress( $coin = 'btc' );
```

*[See the tests](test/test.php) for example usage.*

The `XPub` class also exposes two common hashing methods:

```
# Get a hash160
$hashed_hex = XPub::hash160( $input_hex );

# Get a double sha256
$hashed_hex = XPub::doubleSha256( $input_hex );
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/0496038a30bdea6124c2ff7584a951bdd073787522f691c5f4975861147a5fec?d=identicon)[elis](/maintainers/elis)

---

Top Contributors

[![sisou](https://avatars.githubusercontent.com/u/1828163?v=4)](https://github.com/sisou "sisou (11 commits)")[![el1s7](https://avatars.githubusercontent.com/u/53352199?v=4)](https://github.com/el1s7 "el1s7 (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

### Embed Badge

![Health badge](/badges/elis-xpub/health.svg)

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

###  Alternatives

[inc2734/wp-breadcrumbs

A library for WordPress breadcrumbs.

1543.1k1](/packages/inc2734-wp-breadcrumbs)

PHPackages © 2026

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