Matching BIC and IBAN codes¶

The International Bank Account Number (IBAN) is an internationally agreed system of identifying bank accounts across national borders. The Bank Identifier Code (BIC) is a unique identification code for both financial and non-financial institutions defined in the ISO 9362 standard.

Although both codes are independent, they can be checked in combination to validate that both belong at least to the same country. In Symfony 4.3 we improved the Bic constraint to allow validating BIC and IBAN codes together.

First, you can pass the IBAN code using the new iban option:

1 2 3 4 5 6 7 8 9 use Symfony\Component\Validator\Constraints as Assert ; // ... public static function loadValidatorMetadata ( ClassMetadata $metadata ) { $metadata -> addPropertyConstraint ( 'businessIdentifierCode' , new Assert\Bic ([ 'iban' => 'FR1420041010050500013M02606' , ])); }

You can also use the new ibanPropertyPath option to define the object property that stores the IBAN code: