rikudou / iban
Library for working with IBANs
Installs: 772 906
Dependents: 4
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 2
Open Issues: 0
Requires
- php: ^7.3 | ^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- php-coveralls/php-coveralls: ^2.1
- phpstan/phpstan: ^0.12.63
- phpunit/phpunit: ^9
README
Installation
Via composer: composer require rikudou/iban
Usage
There are multiple IBAN implementations:
Generic IBAN
<?php use Rikudou\Iban\Iban\IBAN; $iban = new IBAN('CZ5530300000001325090010'); echo $iban->asString(); // prints the iban echo strval($iban); // the same as above
Generic IBAN validator
<?php use Rikudou\Iban\Iban\IBAN; $iban = new IBAN('CZ5530300000001325090010'); $validator = $iban->getValidator(); // returns instance of GenericIbanValidator if (!$validator->isValid()) { // do something }
Czech IBAN
Construct IBAN from Czech account number and bank code
<?php use Rikudou\Iban\Iban\CzechIbanAdapter; $iban = new CzechIbanAdapter('1325090010', '3030'); echo $iban->asString(); // prints CZ5530300000001325090010
Czech IBAN validator
<?php use Rikudou\Iban\Iban\CzechIbanAdapter; $iban = new CzechIbanAdapter('1325090010', '3030'); // returns an instance of CompoundValidator which contains // CzechIbanValidator and GenericIbanValidator $validator = $iban->getValidator(); if (!$validator->isValid()) { // do something }
Slovak IBAN
Construct IBAN from Slovak account number and bank code
<?php use Rikudou\Iban\Iban\SlovakIbanAdapter; $iban = new SlovakIbanAdapter('1325090010', '0900'); echo $iban->asString(); // prints SK5009000000001325090010
Slovak IBAN validator
<?php use Rikudou\Iban\Iban\SlovakIbanAdapter; $iban = new SlovakIbanAdapter('1325090010', '0900'); // currently returns just an instance of GenericIbanValidator $validator = $iban->getValidator(); if (!$validator->isValid()) { // do something }
Hungarian IBAN
<?php use Rikudou\Iban\Iban\HungarianIbanAdapter; $iban = new HungarianIbanAdapter('11773016-11111018'); echo $iban->asString(); // prints HU42117730161111101800000000
Hungarian IBAN validator
<?php use Rikudou\Iban\Iban\HungarianIbanAdapter; $iban = new HungarianIbanAdapter('11773016-11111018'); // returns an instance of CompoundValidator which contains // HungarianIbanValidator and GenericIbanValidator $validator = $iban->getValidator(); if (!$validator->isValid()) { // do something }