-
Notifications
You must be signed in to change notification settings - Fork 0
Countries currently supported
This package is designed to support the validation of multiple countries.
So far following countries are implemented:
- Austria
- Belgium
- Estonia
- France
- Germany
- Great Britain
- Italia
- Luxembourg
- Netherland
- Switzerland
- Spain
Note:
Transactions from/to a not supported country can be made by disabling the validation.
(in this case the user have to take care that passed data is valid!)
additional countries can be added relatively easily by implementing a corresponding validation class.
To define country specific validation for IBAN, BIC and CI create a class extending SepaCntryValidationBase
and call Sepa::addValidation('CC', 'MyValidationClassName');
For most of the participating countries, it is sufficient to specify in the constructor the respective length, the formatting rule (RegEx) and the information whether alphanumeric characters are allowed.
If more complicated rules apply in a country, the respective method for validation can be redefined in the extended class in order to map this rule.
(as an example, look at implementation of SepaCntryValidationBE
class)
class MyValidationClassName extends SepaCntryValidationBase
{
/**
* create instance of validation.
* @param string $strCntry 2 sign country code
*/
public function __construct($strCntry)
{
$this->strCntry = 'CC'; // MUST contain the desired country code
$this->iLenIBAN = 20;
$this->strRegExIBAN = '/^([A-Z]){2}([0-9]){18}?$/';
$this->iLenCI = 18;
$this->strRegExCI = '/^([A-Z]){2}([0-9]){2}([0-9A-Z]){3}([0-9]){11}?$/';
parent::__construct(strtoupper($strCntry));
}
}
Information on country specific formats can be found on
-
IBAN:
-
CI:
It would be great if implemented classes for additional countries were shared here in the repo via pull request in order to make them available to other users.
In this case it would also be very helpful to publish valid example numbers for IBAN, BIC and CI in order to expand the unit tests accordingly.
build with phpDocumentor 3 using template phpdoc2githubwiki / (2021-08-31)