vectorface / php-cryptocurrency-address-validation
There is no license information available for the latest version (1.2.7) of this package.
Cryptocurrency address validation. Currently supports 16 coins including litecoin and bitcoin.
1.2.7
2023-09-19 18:34 UTC
Requires
- spomky-labs/cbor-php: ^3.0
Requires (Dev)
- phpunit/phpunit: ^9.0
README
Easy to use PHP Bitcoin and Litecoin address validator. One day I will add other crypto currencies. Or how about you? :)
2021-09-17 - forked from https://github.com/merkeleon/php-cryptocurrency-address-validation needed more features like TestNet vs MainNet filters on validation.
Usage
use Vectorface\PhpCryptocurrencyAddressValidation\Validation; $validator = Validation::make('BTC'); var_dump([ 'classic' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp'), 'options empty (assumes Mainnet)' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp', []), 'options NET MAIN' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp', [ Validation::OPT_NET => Validation::MAINNET ]), 'options NET TEST' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp', [ Validation::OPT_NET => Validation::TESTNET ]), 'options NET garbage (assumes Mainnet)' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp', [ Validation::OPT_NET => 'blah' ]), 'options garbage (assumes Mainnet)' => $validator->validate('1QLbGuc3WGKKKpLs4pBp9H6jiQ2MgPkXRp', [ 'hammer' => 'nail' ]), ]);