International Bank Account Number form type
Simply gives you a nice widget for IBAN numbers, please note that it's based on the default bootstrap form theme (any of the normal or horizontal one).
Install the package:
composer require makinacorpus/iban-bundle
Register the associated form theme in your
twig: debug: "%kernel.debug%" strict_variables: false form_themes: # ... - "IbanBundle:Form:fields.html.twig"
The widget has no options. Just add it to your form:
$this->createFormBuilder() ->add('iban', IbanType::class, [ 'label' => "IBAN", 'required' => true, 'constraints' => [ new Assert\Iban(), ], ])
Please use the
Symfony\Component\Validator\Constraints\Iban class for
validation, it does respect the ISO 7064 standard.