Simple validator for United Kingdom phone numbers validation.

UKPhoneValidator is an extension for validation of United Kingdom phone numbers in all possible ways.


Yii 1.0 or above

Usage Extract UKPhoneValidator.php to your extension directory. The following model code validates attribute in UKPhoneValidator:

public function rules()
   return array(
      array('phone', 'application.extensions.UKPhoneValidator')

Also allowEmpty can be set and message for empty entry. Resources

Total 3 comments

#14210 report it
CrazyCat at 2013/07/26 07:22am
it's interesting

I'm really interested in that, I've fighting with international phones recognition for years, I think I've some of my rules in an old archive too, I'll compare them with yours.

#14209 report it
ineersa at 2013/07/26 07:04am
Great job.

Well i have alot of validations for different countries and attributes. They made to serious data marketing platform, so if it will be interesting i'll add them whe will have some free time.

#14207 report it
CrazyCat at 2013/07/26 05:59am
Good idea

And I add the french version, based on yours and on regexps I'm used to use.

Leave a comment

Please to leave your comment.

Create extension