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

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

pixelpeter/laravel5-isocodes-validation
=======================================

Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux

v3.0.0(7y ago)1987.6k↓100%7[2 PRs](https://github.com/pixelpeter/laravel5-isocodes-validation/pulls)GPL-3.0-or-laterPHPPHP ^7.1CI passing

Since May 22Pushed 2mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (5)Versions (9)Used By (0)

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

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

[![Latest Version on Packagist](https://camo.githubusercontent.com/4ce275070baa789491c1174946f838471cca78def0425ef314f9c9ca4a1902cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel5-isocodes-validation)[![Total Downloads](https://camo.githubusercontent.com/faac385a1120a393c3622e8cccc3a6e8b63067c9b4ae035b308c9be266c1280a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel5-isocodes-validation)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/7b2df34bdf1c8ea852aebedd5b8a723a803d69ed215f47e1e67d984d38a34aee/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pixelpeter/laravel5-isocodes-validation?branch=master)[![Tests](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/run-tests.yml/badge.svg?branch=master)](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/run-tests.yml)[![Fix PHP code style issues](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/fix-php-code-style-issues.yml/badge.svg)](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/fix-php-code-style-issues.yml)[![PHPStan](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/phpstan.yml/badge.svg)](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/phpstan.yml)[![dependabot-auto-merge](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/dependabot-auto-merge.yml/badge.svg)](https://github.com/pixelpeter/laravel5-isocodes-validation/actions/workflows/dependabot-auto-merge.yml)

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

For a **Laravel 8** compatible version please use

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

[](#installation)

### Step 1: Install Through Composer

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

```
composer require pixelpeter/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' => [
    ...
    Pixelpeter\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

47

↑

FairBetter than 94% of packages

Maintenance56

Moderate activity, may be stable

Popularity38

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 77.9% 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 ~195 days

Total

6

Last Release

2563d ago

Major Versions

v1.2.0 → v2.0.02017-12-25

v2.0.1 → v3.0.02019-03-15

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

v2.0.0PHP ^7.0

v2.0.1PHP ^7.1

### 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 (60 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")[![milanvanschaik](https://avatars.githubusercontent.com/u/5149364?v=4)](https://github.com/milanvanschaik "milanvanschaik (2 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (2 commits)")[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (1 commits)")[![SRWieZ](https://avatars.githubusercontent.com/u/1408020?v=4)](https://github.com/SRWieZ "SRWieZ (1 commits)")

---

Tags

isoiso-codeslaravelvalidationlaravelvalidationisoisocode

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[schuppo/password-strength

This package provides a validator for ensuring strong passwords in Laravel 4 applications.

1452.7M1](/packages/schuppo-password-strength)[timacdonald/rule-builder

A fluent rule builder for Laravel validation rule generation.

1017.6k](/packages/timacdonald-rule-builder)[stuyam/laravel-phone-validator

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

2861.0k](/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

1448.2k](/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)

PHPackages © 2026

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