Download the PHP package kielabokkie/bitcoin-address-validator without Composer
On this page you can find all versions of the php package kielabokkie/bitcoin-address-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kielabokkie/bitcoin-address-validator
More information about kielabokkie/bitcoin-address-validator
Files in kielabokkie/bitcoin-address-validator
Package bitcoin-address-validator
Short Description Validate legacy, segwit, native segwit (bech32) and taproot Bitcoin addresses
License MIT
Informations about the package bitcoin-address-validator
Bitcoin Address Validator
Validate legacy, segwit, native segwit (bech32), and taproot Bitcoin addresses.
Requirements
- PHP >= 7.3
PHP | Package Version |
---|---|
7.x | v1.0 |
8.x | v2.0+ |
Please note that taproot addresses are supported from v2.1 of this package.
Installation
Install the package via composer:
Usage
First you instantiate the validator class:
Validate any kind of address (legacy, segwit, native segwit and taproot):
Legacy (P2PKH) address:
Segwit (P2SH) address:
Native segwit (bech32) address:
Taproot (P2TR) address:
Testnet
By default, the validator only passes mainnet addresses as valid. If you would like to validate both mainnet and testnet addresses you can use method chaining:
If you want to validate only testnet addresses you can do that as follows:
Testing
This package is tested against the test data of the official bitcoin/bitcoin repo. If you come across an address that is not validated correctly please open an issue for it.
Run the tests with:
Credits
This package is based on the following packages and uses a lot of their code:
- bitwasp/bech32 by @afk11
- brooksyang/bech32m by BrooksYang
- linusu/bitcoin-address-validator by @LinusU
All credit goes to the original authors.
Donate
Did this package made you lots of money, save you some time or just sparked joy?
A donation would be much appreciated: 32vtWJSomccxQ6y1tgSwSHXN5PChpdYy27
All versions of bitcoin-address-validator with dependencies
ext-bcmath Version *