PHPackages                             pixelpeter/laravel-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. pixelpeter/laravel-isocodes-validation

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

pixelpeter/laravel-isocodes-validation
======================================

Laravel 8+ wrapper for the IsoCodes Validation library from ronanguilloux

v12.1.0(9mo ago)5133.3k↓27.3%GPL-3.0-or-laterPHPPHP ^8.1|^8.2|^8.3|^8.4CI passing

Since Oct 9Pushed 9mo ago1 watchersCompare

[ Source](https://github.com/pixelpeter/laravel-isocodes-validation)[ Packagist](https://packagist.org/packages/pixelpeter/laravel-isocodes-validation)[ Docs](https://github.com/pixelpeter/laravel-isocodes-validation)[ RSS](/packages/pixelpeter-laravel-isocodes-validation/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (8)Versions (9)Used By (0)

Laravel 10+ IsoCodes Validation
===============================

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/ed70dde5a125c01458c558a56ed37f5fcd0b105d9dbfb8ad6de8b2cf1c1cff6b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706978656c70657465722f6c61726176656c2d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d73717561726526743d313233)](https://packagist.org/packages/pixelpeter/laravel-isocodes-validation)[![Total Downloads](https://camo.githubusercontent.com/685ec44b8e785e19a59260141452232a3074a9ac2dcc65e1f695abbbb4bfde51/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c70657465722f6c61726176656c2d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel-isocodes-validation)[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/2cfb52e9d2bb856bfef4ef93b4679b53b04c62eb097ac3d608332d1b08cf652e/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706978656c70657465722f6c61726176656c2d69736f636f6465732d76616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pixelpeter/laravel-isocodes-validation?branch=master)[![Tests](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/run-tests.yml)[![Fix PHP code style issues](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/fix-php-code-style-issues.yml)[![PHPStan](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/phpstan.yml/badge.svg)](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/phpstan.yml)[![dependabot-auto-merge](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/dependabot-auto-merge.yml/badge.svg)](https://github.com/pixelpeter/laravel-isocodes-validation/actions/workflows/dependabot-auto-merge.yml)

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

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

[](#installation)

### Install With Composer

[](#install-with-composer)

```
composer require pixelpeter/laravel-isocodes-validation
```

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

48

—

FairBetter than 93% of packages

Maintenance56

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 94.3% 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 ~205 days

Recently: every ~83 days

Total

8

Last Release

294d ago

Major Versions

v8.1.0 → v10.0.02024-10-14

v8.1.1 → v10.1.02024-10-14

v10.1.0 → v12.0.02025-04-01

PHP version history (4 changes)v8.0.0PHP ^7.3|^8.0

v8.1.0PHP ^8.0|^8.1|^8.2

v10.0.0PHP ^8.1|^8.2|^8.3

v12.0.0PHP ^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6502630?v=4)[pixelpeter](/maintainers/pixelpeter)[@pixelpeter](https://github.com/pixelpeter)

---

Top Contributors

[![pixelpeter](https://avatars.githubusercontent.com/u/6502630?v=4)](https://github.com/pixelpeter "pixelpeter (33 commits)")[![elcapo](https://avatars.githubusercontent.com/u/1746692?v=4)](https://github.com/elcapo "elcapo (1 commits)")[![MASNathan](https://avatars.githubusercontent.com/u/2139464?v=4)](https://github.com/MASNathan "MASNathan (1 commits)")

---

Tags

laravelvalidationisoisocode

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pixelpeter-laravel-isocodes-validation/health.svg)

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

###  Alternatives

[crazybooot/base64-validation

Laravel validators for base64 encoded files

1352.0M8](/packages/crazybooot-base64-validation)[pixelpeter/laravel5-isocodes-validation

Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux

1987.8k1](/packages/pixelpeter-laravel5-isocodes-validation)[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1043.3k6](/packages/carsdotcom-laravel-json-schema)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)

PHPackages © 2026

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