PHP code example of jschaedl / iban

1. Go to this page and download the library: Download jschaedl/iban library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jschaedl / iban example snippets






use IBAN\Validation\IBANValidator;
use IBAN\Generation\IBANGeneratorDE;
use IBAN\Generation\IBANGeneratorNL;
    
// validation example
$ibanValidator = new IBANValidator();
if ($ibanValidator->validate('DE89370400440532013000')) {
	echo "DE89370400440532013000 is valid!";
}
 
// generate german iban example #1
$ibanGenerator = new IBANGeneratorDE();
$generatedIban = $ibanGenerator->generate('60050101', '502502502'); 
// $generatedIban => DE15600501010001108884

// generate german iban example #2
$generatedIban = IBANGenerator::DE('60050101', '502502502');
// $generatedIban => DE15600501010001108884

// generate dutch iban example #1
$ibanGenerator = new IBANGeneratorNL();
$generatedIban = $ibanGenerator->generate('ABNA', '123456789'); 
// $generatedIban => NL02ABNA0123456789

// generate dutch iban example #2
$generatedIban = IBANGenerator::NL('ABNA', '123456789');
// $generatedIban => NL02ABNA0123456789