PHPackages                             thunken/laravel5-isocodes-validation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. thunken/laravel5-isocodes-validation

AbandonedArchivedLibrary[Validation &amp; Sanitization](/categories/validation)

thunken/laravel5-isocodes-validation
====================================

Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux

v4.0.1(6y ago)0195GPL-3.0-or-laterPHPPHP ^7.1

Since May 22Pushed 6y agoCompare

[ Source](https://github.com/thunken/laravel5-isocodes-validation)[ Packagist](https://packagist.org/packages/thunken/laravel5-isocodes-validation)[ Docs](https://github.com/thunken/laravel5-isocodes-validation)[ RSS](/packages/thunken-laravel5-isocodes-validation/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (5)Versions (11)Used By (0)

Laravel 5 IsoCodes Validation
=============================

[](#laravel-5-isocodes-validation)

[![Latest Version on Packagist](https://camo.githubusercontent.com/83953d8bfb28bbcca9b3494a365f0748b488d092f4fc68666b6243e19412f5fb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d73717561726526743d313233)](https://packagist.org/packages/thunken/laravel5-isocodes-validation)[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Travis Build](https://camo.githubusercontent.com/62494036423c90d3fae9b75bfa52827fb158e0756e1146dced6c62e9dc52454e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/thunken/laravel5-isocodes-validation)[![Scrutinizer Quality](https://camo.githubusercontent.com/39f443a02baefb7c73fb3a61467f948cd61e2cd7d0bd609a7041600b5a5b7835/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thunken/laravel5-isocodes-validation)[![Scrutinizer Build](https://camo.githubusercontent.com/24d0910d9fc8e8f389d883b816efdfe285487e998155fe1c5c8cee2ce24bedc8/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/thunken/laravel5-isocodes-validation)[![SensioLabsInsight](https://camo.githubusercontent.com/7a85c94b9f7e811749a7b22b3bf6ad0aa0aca51c661b73cf388188e2fcbf4524/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f33323633356232302d613132302d343664652d613161662d3463653837366264636662652e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/32635b20-a120-46de-a1af-4ce876bdcfbe)[![Total Downloads](https://camo.githubusercontent.com/944b7c57bf3dc1d61e973752ab6813783a60fd4ca84e57671c041d64126f7873/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/thunken/laravel5-isocodes-validation)[![Coverage Status](https://camo.githubusercontent.com/ee54add6de7bfa16c4f1a474125fa5d242383e37791fe75ba938a4eccea4ddc5/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f7468756e6b656e2f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/thunken/laravel5-isocodes-validation?branch=master)

A simple Laravel 5 wrapper for the [IsoCodes Validation library](https://github.com/ronanguilloux/IsoCodes) from ronanguilloux.

Installation
------------

[](#installation)

### Step 1: Install Through Composer

[](#step-1-install-through-composer)

```
composer require thunken/laravel5-isocodes-validation
```

### Step 2: Add the Service Provider

[](#step-2-add-the-service-provider)

*(not needed starting with v2.x because of auto discovery)*

Add the service provider in `app/config/app.php`

```
'provider' => [
    ...
    Thunken\IsoCodesValidation\IsoCodesValidationServiceProvider::class,
    ...
];
```

Usage
-----

[](#usage)

### Simple examples

[](#simple-examples)

```
// Checking out your e-commerce shopping cart?
$payload = [
    'creditcard' => '12345679123456'
];
$rules = [
    'creditcard' => 'creditcard'
];

$validator = Validator::make($payload, $rules);
```

### Examples with reference parameter

[](#examples-with-reference-parameter)

Some rules need a reference to be validated against (e.g. `country` for `zipcode`).

Just pass the name of the field holding the reference to the rule.

```
// Sending letters to the Labrador Islands ?
$payload = [
    'zipcode' => 'A0A 1A0',
    'country' => 'CA'
];
$rules = [
    'zipcode' => 'zipcode:country'
];

$validator = Validator::make($payload, $rules);

// Publishing books?
$payload = [
    'isbn' => '2-2110-4199-X',
    'isbntype' => 13
];
$rules = [
    'zipcode' => 'isbn:isbntype'
];

$validator = Validator::make($payload, $rules);
```

### Example with arrays and dot notation

[](#example-with-arrays-and-dot-notation)

*(added in v3.x)*

As suggested by @otr-tomek I've added support for all validation methods using arrays in dot notation as an input.

```
$payload = [
    'data' => [
        [
            'country' => 'DE',
            'zipcode' => 63741
        ],
        [
            'country' => 'AT',
            'zipcode' => 1180
        ]
  ]
];

$validator = Validator::make($payload, [
    'data.*.zipcode' => 'zipcode:data.*.country'
]);
```

### Validation error messages

[](#validation-error-messages)

Error messages can contain the name and value of the field and the value of the reference

```
$payload = [
    'phonenumber' => 'invalid',
    'country' => 'GB'
];
$rules = [
    'phonenumber' => 'phonenumber:country'
];

$validator = Validator::make($payload, $rules);

print $validator->errors()->first(); // The value "invalid" of phonenumber is not valid for "GB".
```

### More Examples

[](#more-examples)

Refer to [IsoCodes Validation library](https://github.com/ronanguilloux/IsoCodes) for more examples and documentation.

Testing
-------

[](#testing)

Run the tests with:

```
vendor/bin/phpunit
```

License
-------

[](#license)

GNU General Public License v3.0 only. Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 89.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~191 days

Total

8

Last Release

2301d ago

Major Versions

v1.2.0 → v2.0.02017-12-25

v2.0.1 → v3.0.02019-03-15

v3.0.0 → v4.0.02020-01-22

PHP version history (3 changes)v1.0PHP &gt;=5.5.9

v2.0.0PHP ^7.0

v2.0.1PHP ^7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/f1ede77608e92ee9488870b9835218ed34261c8cf49227673af5625da01f6b09?d=identicon)[damsvann](/maintainers/damsvann)

---

Top Contributors

[![pixelpeter](https://avatars.githubusercontent.com/u/6502630?v=4)](https://github.com/pixelpeter "pixelpeter (44 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (2 commits)")[![milanvanschaik](https://avatars.githubusercontent.com/u/5149364?v=4)](https://github.com/milanvanschaik "milanvanschaik (2 commits)")[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (1 commits)")

---

Tags

laravelvalidationisoisocode

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thunken-laravel5-isocodes-validation/health.svg)

```
[![Health](https://phpackages.com/badges/thunken-laravel5-isocodes-validation/health.svg)](https://phpackages.com/packages/thunken-laravel5-isocodes-validation)
```

###  Alternatives

[pixelpeter/laravel5-isocodes-validation

Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux

1987.6k](/packages/pixelpeter-laravel5-isocodes-validation)[stuyam/laravel-phone-validator

A phone validator for Laravel using the free Twilio phone lookup service.

2861.3k](/packages/stuyam-laravel-phone-validator)[skysplit/laravel5-intl-translation

Laravel 5 package for better translation syntax using php-intl extension

10106.2k](/packages/skysplit-laravel5-intl-translation)[pacerit/laravel-polish-validation-rules

Simple Polish Validation rules for Laravel and Lumen framework

1449.9k](/packages/pacerit-laravel-polish-validation-rules)[laravel-validation-rules/ip

Validate if an ip address is public or private.

1729.7k](/packages/laravel-validation-rules-ip)[cohensive/validation

Extra functionality for Laravel 5 Validator.

1513.9k](/packages/cohensive-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
