PHP code example of vectorface / php-cryptocurrency-address-validation

1. Go to this page and download the library: Download vectorface/php-cryptocurrency-address-validation library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

vectorface / php-cryptocurrency-address-validation example snippets


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