定制 linusu/bitcoin-address-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

linusu/bitcoin-address-validator

最新稳定版本:v0.1.2

Composer 安装命令:

composer require linusu/bitcoin-address-validator

包简介

A simple, easy to use PHP Bitcoin address validator

README 文档

README

A simple, easy to use PHP Bitcoin address validator

Usage

Quick start:

use \LinusU\Bitcoin\AddressValidator;

// This will return false, indicating invalid address.
AddressValidator::isValid('blah');

// This is a valid address and will thus return true.
AddressValidator::isValid('1AGNa15ZQXAZUgFiqJ2i7Z2DPU2J6hW62i');

// This is a Testnet address, it's valid and the function will return true.
AddressValidator::isValid('mo9ncXisMeAoXwqcV5EWuyncbmCcQN4rVs', AddressValidator::TESTNET);

API

isValid($addr, $version)

  • $addr: A bitcoin address
  • $version: The version to test against, defaults to MAINNET

Returns a boolean indicating if the address is valid or not.

typeOf($addr)

  • $addr: A bitcoin address

Returns the type of the address.

Constants

The library exposes the following constants.

  • MAINNET: Indicates any mainnet address type
  • TESTNET: Indicates any testnet address type
  • MAINNET_PUBKEY: Indicates a mainnet pay to pubkey hash address
  • MAINNET_SCRIPT: Indicates a mainnet pay to script hash address
  • TESTNET_PUBKEY: Indicates a testnet pay to pubkey hash address
  • TESTNET_SCRIPT: Indicates a testnet pay to script hash address

统计信息

  • 总下载量: 150.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 54
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 54
  • Watchers: 9
  • Forks: 29
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-04-14