PHPackages                             andkom/php-bitcoin-address - 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. andkom/php-bitcoin-address

ActiveLibrary

andkom/php-bitcoin-address
==========================

A simple P2PK, P2PKH, P2SH, P2WPKH, P2WSH output script/address generator.

2.0.1(2y ago)21864↓100%11[1 PRs](https://github.com/andkom/php-bitcoin-address/pulls)MITPHPPHP &gt;=7.1

Since Jan 28Pushed 2y ago2 watchersCompare

[ Source](https://github.com/andkom/php-bitcoin-address)[ Packagist](https://packagist.org/packages/andkom/php-bitcoin-address)[ RSS](/packages/andkom-php-bitcoin-address/feed)WikiDiscussions master Synced today

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

PHP Bitcoin Address
-------------------

[](#php-bitcoin-address)

A simple P2PK, P2PKH, P2SH, P2WPKH, P2WSH, P2TR output script/address parser/generator/validator.

**Supported types:**

- Pay-To-PubKey (P2PK)
- Pay-To-PubKeyHash (P2PKH)
- Pay-To-Multisig (P2MS)
- Pay-To-ScriptHash (P2SH)
- Pay-To-WitnessPubKeyHash (P2WPKH)
- Pay-To-WitnessScriptHash (P2WSH)
- Pay-To-Taproot (P2TR)
- P2WPKH-over-P2SH
- P2WSH-over-P2SH
- any combination

**Supported networks:**

- Bitcoin
- Bitcoin Testnet
- Bitcoin Gold
- Bitcoin Cash
- Litecoin
- Litecoin Testnet
- Dogecoin
- Dogecoin Testnet
- Viacoin
- Viacoin Testnet
- Dash
- Dash Testnet
- Zcash

### Installation

[](#installation)

```
composer require andkom/php-bitcoin-address
```

### Examples

[](#examples)

Generate a P2PK/P2PKH address:

```
$address = OutputFactory::p2pk($pubKey)->address();
$address = OutputFactory::p2pkh($pubKeyHash)->address();
```

Generate a P2MS address:

```
$address = OutputFactory::p2ms(2, [$pubKey1, $pubKey2, $pubKey3])->address();
```

Generate a P2SH address:

```
$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$address = $factory->p2sh($p2ms)->address();
```

Generate a P2WPKH address:

```
$address = OutputFactory::p2wpkh($pubKeyHash)->address();
```

Generate a P2WSH address:

```
$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$address = $factory->p2wsh($p2ms)->address();
```

Generate a P2WPKH-over-P2SH address:

```
$factory = new OutputFactory();
$p2wpkh = $factory->p2wpkh($pubKeyHash);
$address = $factory->p2sh($p2wpkh)->address();
```

Generate a P2WSH-over-P2SH address:

```
$factory = new OutputFactory();
$p2ms = $factory->p2ms(2, [$pubKey1, $pubKey2, $pubKey3]);
$p2wsh = $factory->p2wsh($p2ms);
$address = $factory->p2sh($p2wsh)->address();
```

Generate a P2TR address:

```
$taprootPubKey = Taproot::construct($pubKey);
$address = OutputFactory::p2tr($taprootPubKey)->address();
```

Generate an address from an output script:

```
$address = OutputFactory::fromScript($script)->address();
```

Decode a Bitcoin address:

```
$output = NetworkFactory::bitcoin()->decodeAddress('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH');
```

Get a Bitcoin address type:

```
$type = NetworkFactory::bitcoin()->decodeAddress('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH')->type(); // p2pkh
```

Validate a Bitcoin address:

```
NetworkFactory::bitcoin()->validateAddress('1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH'); // true
```

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity49

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

Total

3

Last Release

857d ago

Major Versions

1.0.0 → 2.0.02023-11-15

PHP version history (2 changes)1.0.0PHP ^7.0

2.0.0PHP &gt;=7.1

### Community

Maintainers

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

---

Top Contributors

[![andkom](https://avatars.githubusercontent.com/u/150830?v=4)](https://github.com/andkom "andkom (24 commits)")

---

Tags

addressaddress-parseraddress-validationbitcoinbitcoin-addressbitcoin-scriptoutputschnorrschnorr-signaturesscripttaprootaddressgeneratorbitcoin

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/andkom-php-bitcoin-address/health.svg)

```
[![Health](https://phpackages.com/badges/andkom-php-bitcoin-address/health.svg)](https://phpackages.com/packages/andkom-php-bitcoin-address)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k108.7M496](/packages/symfony-maker-bundle)[simplesoftwareio/simple-qrcode

Simple QrCode is a QR code generator made for Laravel.

2.9k26.8M78](/packages/simplesoftwareio-simple-qrcode)[commerceguys/addressing

Addressing library powered by CLDR and Google's address data.

95229.5M35](/packages/commerceguys-addressing)[linusu/bitcoin-address-validator

A simple, easy to use PHP Bitcoin address validator

54150.4k3](/packages/linusu-bitcoin-address-validator)[kielabokkie/bitcoin-address-validator

Validate legacy, segwit, native segwit (bech32) and taproot Bitcoin addresses

36271.1k](/packages/kielabokkie-bitcoin-address-validator)[phpowermove/docblock

PHP Docblock parser and generator. An API to read and write Docblocks.

2522.9M4](/packages/phpowermove-docblock)

PHPackages © 2026

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