LaravelPackages.net
Acme Inc.
Toggle sidebar
fynduck/isin

A Laravel package for generate and validating an ISIN (International Securities Identification Number / ISO 6166)

34
0
v1.0.2.1
About fynduck/isin

fynduck/isin is a Laravel package for a laravel package for generate and validating an isin (international securities identification number / iso 6166). It currently has 0 GitHub stars and 34 downloads on Packagist (latest version v1.0.2.1). Install it with composer require fynduck/isin. Discover more Laravel packages by fynduck or browse all Laravel packages to compare alternatives.

Last updated

Isin

Software License Latest Version on Packagist Total Downloads

A Laravel package for generate and 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 fynduck/isin

Usage

You can instantiate an ISIN object by passing in a string

use fynduck\Isin;

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

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

$isin->getValue();
return GB00B3W23161

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

$isin->getCheckDigit();
return 1

Generate ISINs

Isin::generateDigit('GB00B3W2316');
return: 1

Validating ISINs

There are some helper static functions for simple validation.

Isin::isValid('GB00B3W23161');
return true

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

Isin::validate('gb00b3w23161');
return GB00B3W23161
$number = Isin::validate('ABC');
return InvalidISINException

This will return the properly formatted ISIN (whitespace trimmed and converted to uppercase). It will throw a fynduck\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%.

Star History Chart