axlon / laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen
MIT License
369 stars 29 forks source link

No error for incorrect postal codes #11

Closed redon92 closed 5 years ago

redon92 commented 5 years ago

It doesn't show any error for incorrect postal codes, for example if i insert a postal code 55555 for IT (Italy), and it doesn't show any error. All it does is check if the inserted postal code has the postal code length of that country:

'pattern' => '/^\d{5}$/i',

I suggest you submit postal codes from the world in this package, and then it would be available to laravel users, and updated accordingly, to avoid such problems.

axlon commented 5 years ago

This package uses Google's address data service to create rules a postal code in a given country should follow.

Some countries have prefixes or suffixes and are very specific in what they will allow (e.g. UK), but for some countries there simply isn't a better pattern than the one provided.