djmarland/isin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

djmarland/isin

最新稳定版本:v1.0.0

Composer 安装命令:

composer require djmarland/isin

包简介

A PHP Library for storing a validating an ISIN (International Securities Identification Number / ISO 6166)

README 文档

README

A PHP Library for storing a validating an ISIN (International Securities Identification Number / ISO 6166). ISINs will be checked against the checksum as detailed at [https://en.wikipedia.org/wiki/International_Securities_Identification_Number]

Installation

The library can be installed via composer

composer require djmarland/isin

Usage

You can instantiate an ISIN object by passing in a string

use Djmarland\ISIN;

$number = 'GB00B3W23161';
$isin = new ISIN($number);

If the value passed in was not a valid ISIN it will throw a Djmarland\ISIN\Exception\InvalidISINException To get the value back out you can do

$value = $isin->getValue();
// GB00B3W23161

If you want to get hold of just the check digit you can use

$digit = $isin->getCheckDigit();
// 1

The object has a __toString so usage in views/routes etc will work:

echo 'The ISIN is ' . $isin;
// The ISIN is GB00B3W23161

Validating ISINs

There are some helper static functions for simple validation.

$valid = ISIN::isValid('GB00B3W23161');
// true

This will return true if the value was a valid ISIN, false otherwise.

$number = ISIN::validate('gb00b3w23161');
// GB00B3W23161
$number = ISIN::validate('ABC');
// InvalidISINException

This will return the properly formatted ISIN (whitespace trimmed and converted to uppercase). It will throw a Djmarland\ISIN\Exception\InvalidISINException if the input was not valid.

Development

This project is open source. Feedback and pull requests are welcome. To develop the code:

Checkout the project. Run composer install

Running Tests

PHPUnit

vendor/bin/phpunit

Code Sniffer

vendor/bin/phpcs

Both must be run successfully before code can be submitted. Code coverage must also be 100%.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-02-28