2017 © Pedro Peláez
 

library isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

image

ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  • Saturday, May 12, 2018
  • by Ronan
  • Repository
  • 23 Watchers
  • 520 Stars
  • 283,239 Installations
  • PHP
  • 15 Dependents
  • 0 Suggesters
  • 61 Forks
  • 18 Open issues
  • 18 Versions
  • 13 % Grown

The README.md

IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book Industry, Phone numbers & Zipcodes for many countries, (*1)

Usage

// Sending letters to the Labrador Islands ?
$isCanadian = ZipCode::validate('A0A 1A0', 'CA');

// Checking out your e-commerce shopping cart?
$isBankable = CreditCard::validate('12345679123456');

// Transferring money worldwide?
$isSwiftBic = SwiftBic::validate('CEDELULLXXX');

// Paying your taxes in Madrid?
$isTaxableInSpain = Nif::validate('A999999L');

// Receiving containers from Port of Shanghai?
$isShippingContainerCode = Sscc::validate('806141411234567896');

// Publishing books?
$isPublished = Isbn::validate('2-2110-4199-X')

// Trading items with GTIN barcodes in GS1 system?
$isBarcode = Ean13::validate('4719512002889')

// Calling phone numbers in Palo Alto?
$isPhonable = PhoneNumber::validate('+1-650-798-2800', 'US')

// Buying Apple stocks?
$isISIN = Isin::validate('US0378331005'); // Apple Inc. (AAPL)

// Trading Apple products?
$isCUSIP = Cusip::validate('037833100'); // Apple Inc. (AAPL)

// Checking your iPhone device is valid?
$isDevice = Imei::validate('352066060926230');

// Selling your Honda Civic?
$isVin = VinNA::validate('1HGBH41JXMN109186');    

ISO Codes Validations available:

International Finance

  • IBAN (requires bcmath PHP extension)
  • SWIFT/BIC
  • BBAN (RIB, requires bcmath PHP extension)
  • Credit Card number
  • SEDOL (Stock Exchange codes)

Manufacturing Industries

  • ISBN - International Standard Book Number, both 10 & 13 digits
  • ISMN - International Standard Music Number
  • ISWC - International Standard Musical Work Code
  • IMEI - International Mobile Equipment Identity
  • VIN - Vehicle Identification Number – ISO 3779 & ISO 4030

Public Administrations

  • ISIN - International Securities Identification Number
  • Country-specific VAT / tax system: various VAT number formats
  • France: Numéro de Sécurité Sociale / INSEE, SIREN, SIRET, Codes postaux, Clef Type 1/2 Norme B2
  • US: Social Security number
  • UK: National Insurance Number (NINO)
  • Belgium: Structured Ccommunication ("communication structurée")
  • Spain: NIF, NIE (Número de Identificación Fiscal/Extranjero) & CIF (Código de identificación fiscal)
  • Netherlands: Burgerservicenummer / Citizen Service Number (BSN)
  • Finland: HETU, Henkilötunnus (Finnish personal identity code)
  • Switzerland: Business Orgs UID (VAT) Number / Unternehmens-Identifikationsnummer

GS1 specific numbers/identifiers

  • GTIN - Global Trade Item Number: GTIN-8, GTIN-12, GTIN-13, GTIN-14
  • GLN - Global Location Number
  • SSCC - Serial Shipping Container Code
  • GRAI - Global Returnable Asset Identifier
  • GSRN - Global Service Relation Number
  • GDTI - Global Document Type Identifier
  • UDI - Unique Device Identification (the GTIN part of it)
  • Older/deprecated identifiers, now in GTIN: EAN-8, EAN-13, UCC-13, UPC-A, DUN-14, ITF-14

Miscellaneous

  • ZIP code validators for 175+ countries
  • Phone number validation for all countries/regions of the world

Each code has its own validator. Each validator is illustrated by a unit test case., (*2)

IsoCodes is compatible with all versions of PHP that are actively supported by the PHP project., (*3)

Build status

License Latest Stable Version Build Status Scrutinizer Code Quality SymfonyInsight Coverage Status Total Downloads Monthly Downloads Daily Downloads, (*4)

Continously inspecting results (phpdoc, phpmd, phpcc, etc.) available on Scrutinizer CI, (*5)

bcmath as an optional extension for certain validators

For IBAN & BBAN ISO-codes, PHP is required to be compiled with "--enable-bcmath" for arbitrary precision mathematic checks. Usually, you already have bcmath bundled in your PHP version, since many common PHP packages (php-cli, php-fpm, php5-cgi, libapache2-mod-php5, etc.) in stable GNU/Linux distribution releases (such as Debian) are listed as having bcmath built in to them, as an included module., (*6)

Installing

Via GitHub

$ git clone git@github.com:ronanguilloux/IsoCodes.git

Autoloading is PSR-0 friendly., (*7)

Via Packagist & Composer

Require the latest version of ronanguilloux/isocodes with Composer, (*8)

$ composer require ronanguilloux/isocodes

Wrappers

With Symfony Validator

Install Soullivaneuh/IsoCodesValidator to get IsoCodes working as Validator for Symfony and Silex., (*9)

With CakePHP 3

Install gourmet/validation to get IsoCodes working with CakePHP 3 as a validator., (*10)

With Laravel

Install pixelpeter/laravel5-isocodes-validation to get IsoCodes working with Laravel 5 as a validator., (*11)

Supported PHP versions

  • 7.3
  • 7.4

Unit testing

$ phpunit --testdox --coverage-text

Make utilities

For development & contribution purpose only, a Makefile provides various tools to check your code style, quality & test coverage:, (*12)

Usual tasks:

    To initialize vendors:  make
    To check code quality:  make quality
    To run tests suite:     make tests
    To fix code style:      make cs-fix

Other specific tasks:

    To evaluate code coverage:                  make codecoverage
    To run a simple continuous tests server:    make continuous
    To dry-fix code style issues:               make dry-fix
    To evaluate code quality stats:             make stats
    To update vendors using Composer:           make update

Quality assurance report

Isocodes quality plan is mainly based on phpunit: it runs 980+ unit tests, with separated valid & invalid entry sets. Test values are mainly real data or documented examples from standard documentation, and a few handmade values., (*13)

The composer.json already includes these Php Quality Assurance Toolchain libraries:, (*14)

Just run:, (*15)

$ make stats -i

XML report outputs are then generated in a new ./build folder, (*16)

Code covering report built using Coveralls.io. How-to generate such code coverage report using PHPUnit., (*17)

License Information

  • GNU GPL v3
  • You can find a copy of this software here: https://github.com/ronanguilloux/IsoCodes

Contributing Code

The issue queue can be found at: https://github.com/ronanguilloux/IsoCodes/issues. See CONTRIBUTING.md., (*18)

Special thanks

Contributors list: Many thanks to all!, (*19)

Many thanks to JetBrains PhpStorm for having sponsored the IsoCode library development from the very beginning! Any contributor having an accepted PR may receive an Open Source License Key for PhpStorm IDE. Just ping Ronan via email to get one., (*20)

The Versions

12/05 2018

dev-isan

dev-isan https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc hetu

11/05 2018

2.1.4

2.1.4.0 https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc hetu

09/05 2018

dev-master

9999999-dev https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc hetu

03/12 2017

dev-fix-hhvm

dev-fix-hhvm https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc

02/12 2017

2.1.3

2.1.3.0 https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc

08/08 2017

2.1.2

2.1.2.0 https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc

10/01 2017

2.1.1

2.1.1.0 https://github.com/ronanguilloux/IsoCodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers & Zipcodes for many countries

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

validator iban finance siren siret standard cif iso swift phone number book isbn vat zipcode gs1 sscc gln bban bic isin ean13 upc-a gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1 grai gdti gsrn dun public administrations udi ismn iswc

20/03 2016

2.1.0

2.1.0.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), ISBN, EAN13, UPC-A, GS1 / GTIN, SSCC, Spanish CIF & NIF, SEDOL, ISIN, Phone number

  Sources   Download

GPL-3.0+

The Requires

 

The Development Requires

iban siren siret cif swift phone number isbn vat zipcode gs1 sscc bban bic isin ean13 upc-a iso codes gtin ssn rib credit card number insee nss nif nino sedol ucc-13 dun-14 itf gs-1

27/12 2015

2.0.0

2.0.0.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), ISBN & EAN13, Spanish CIF & NIF, SEDOL

  Sources   Download

GPL-3.0+

The Requires

  • ext-bcmath *
  • php >=5.6.0

 

The Development Requires

iban siren siret cif swift isbn vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif nino sedol

22/06 2015

1.2.0

1.2.0.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), ISBN & EAN13, Spanish CIF & NIF

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.4.0
  • ext-bcmath *

 

The Development Requires

iban siren siret cif swift isbn vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif nino

02/05 2015

1.1.4

1.1.4.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), EAN13, Spanish CIF & NIF

  Sources   Download

GPL-3.0+

The Requires

  • ext-bcmath *
  • php >=5.4.0

 

The Development Requires

iban siren siret cif swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif nino

02/05 2015

1.1.3

1.1.3.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), EAN13, Spanish CIF & NIF

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3.0
  • ext-bcmath *

 

The Development Requires

iban siren siret cif swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif nino

02/05 2015

1.1.2

1.1.2.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, NINO, Zipcode (US, Canada, France...), EAN13, Spanish CIF & NIF

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret cif swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif nino

02/05 2015

1.1.1

1.1.1.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, Uknin, Zipcode (US, Canada, France...), EAN13, Spanish CIF & NIF

  Sources   Download

GPL-3.0+

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret cif swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss nif uknin

02/05 2015

1.1.0

1.1.0.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, Uknin, Zipcode (US, Canada, France...), EAN13

  Sources   Download

GNU General Public License v3.0

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss uknin

02/05 2015

1.0.2

1.0.2.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, Uknin, Zipcode (US, Canada, France...), EAN13

  Sources   Download

GNU General Public License v3.0

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss uknin

02/05 2015

1.0.1

1.0.1.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, Uknin, Zipcode (US, Canada, France...), EAN13

  Sources   Download

GNU General Public License v3.0

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss uknin

02/05 2015

1.0.0

1.0.0.0 https://github.com/ronanguilloux/IsoCodes

PHP library, validating various ISO codes, such as IBAN, SWIFT/BIC, BBAN, RIB, Credit Card number, INSEE, VAT, NSS, Siren, Siret, Ssn, Uknin, Zipcode (US, Canada, France...), EAN13

  Sources   Download

GNU General Public License v3.0

The Requires

  • php >=5.3.0

 

The Development Requires

iban siren siret swift vat zipcode bban bic ean13 iso codes ssn rib credit card number insee nss uknin