PHPackages                             loro102/isocodesvalidation - 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. loro102/isocodesvalidation

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

loro102/isocodesvalidation
==========================

Laravel 5 wrapper for the IsoCodes Validation library from ronanguilloux forked pixelpeter

017PHP

Since Mar 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/loro102/isocodevalidator)[ Packagist](https://packagist.org/packages/loro102/isocodesvalidation)[ RSS](/packages/loro102-isocodesvalidation/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)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)[![Software License](https://camo.githubusercontent.com/e1514dd3f2095dbf68a0008ae62a631142953ad2e86aa94c504343f2c2c191da/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d47504c2d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Travis Build](https://camo.githubusercontent.com/6c05e6d0946f57b96de1547e9296d3b96de418a4ef110470a2811944daacdf61/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/pixelpeter/laravel5-isocodes-validation)[![Scrutinizer Quality](https://camo.githubusercontent.com/1d2337b5a33839a02f6823840f45627c2299e9fb3c992ef1acff5a21c1e790dd/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pixelpeter/laravel5-isocodes-validation)[![Scrutinizer Build](https://camo.githubusercontent.com/35d7e39408f7e464d82b323738c8fd580adbbfa8e7dbe2c8487c617f8a8f3cb1/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f6275696c642f672f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/pixelpeter/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/faac385a1120a393c3622e8cccc3a6e8b63067c9b4ae035b308c9be266c1280a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pixelpeter/laravel5-isocodes-validation)[![Dependency Status](https://camo.githubusercontent.com/cc51da15190cdf4d37b998f00804d15f63fd62bd628b38613bfcce4d293bea6d/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537343161343435636538643065303034353035656133632f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/user/projects/5741a445ce8d0e004505ea3c)[![Coverage Status](https://camo.githubusercontent.com/7b2df34bdf1c8ea852aebedd5b8a723a803d69ed215f47e1e67d984d38a34aee/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f706978656c70657465722f6c61726176656c352d69736f636f6465732d76616c69646174696f6e2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/pixelpeter/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 loro102/isocodesvalidation
```

### Step 2: Add the Service Provider (not needed with v2.x because of auto discovery)

[](#step-2-add-the-service-provider-not-needed-with-v2x-because-of-auto-discovery)

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

```
'provider' => [
    ...
    loro102\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 parameter

[](#examples-with-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);
```

### 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

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![loro102](https://avatars.githubusercontent.com/u/1963808?v=4)](https://github.com/loro102 "loro102 (8 commits)")

### Embed Badge

![Health badge](/badges/loro102-isocodesvalidation/health.svg)

```
[![Health](https://phpackages.com/badges/loro102-isocodesvalidation/health.svg)](https://phpackages.com/packages/loro102-isocodesvalidation)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[nette/forms

📝 Nette Forms: generating, validating and processing secure forms in PHP. Handy API, fully customizable, server &amp; client side validation and mature design.

54013.2M450](/packages/nette-forms)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)

PHPackages © 2026

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