vectorface/php-cryptocurrency-address-validation

There is no license information available for the latest version (1.2.6) of this package.

Cryptocurrency address validation. Currently supports 16 coins including litecoin and bitcoin.

1.2.6 2021-09-20 14:37 UTC

This package is auto-updated.

Last update: 2022-11-20 17:16:30 UTC


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' ]),
]);