{"id":27991239,"url":"https://github.com/pixelpeter/laravel-isocodes-validation","last_synced_at":"2025-08-13T18:11:10.414Z","repository":{"id":57042119,"uuid":"415289235","full_name":"pixelpeter/laravel-isocodes-validation","owner":"pixelpeter","description":"Laravel 8+ wrapper for the IsoCodes Validation library from ronanguilloux ","archived":false,"fork":false,"pushed_at":"2025-04-02T10:20:57.000Z","size":41,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-08T16:56:50.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pixelpeter.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-09T11:26:16.000Z","updated_at":"2025-04-01T08:25:33.000Z","dependencies_parsed_at":"2025-04-01T08:35:46.450Z","dependency_job_id":"5e311c18-396a-45de-8c85-7c084c0e8eb4","html_url":"https://github.com/pixelpeter/laravel-isocodes-validation","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixelpeter%2Flaravel-isocodes-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixelpeter%2Flaravel-isocodes-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixelpeter%2Flaravel-isocodes-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pixelpeter%2Flaravel-isocodes-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pixelpeter","download_url":"https://codeload.github.com/pixelpeter/laravel-isocodes-validation/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253112073,"owners_count":21856070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-08T16:56:55.747Z","updated_at":"2025-05-08T16:56:56.474Z","avatar_url":"https://github.com/pixelpeter.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel 8+ IsoCodes Validation\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/pixelpeter/laravel-isocodes-validation.svg?style=flat-square\u0026t=123)](https://packagist.org/packages/pixelpeter/laravel-isocodes-validation)\n[![Total Downloads](https://img.shields.io/packagist/dt/pixelpeter/laravel-isocodes-validation.svg?style=flat-square)](https://packagist.org/packages/pixelpeter/laravel-isocodes-validation)\n[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat-square)](LICENSE.md)\n[![Coverage Status](https://coveralls.io/repos/github/pixelpeter/laravel-isocodes-validation/badge.svg?branch=master)](https://coveralls.io/github/pixelpeter/laravel-isocodes-validation?branch=master)\n[![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)\n[![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)\n[![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)\n[![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)\n\nA simple Laravel 8+ wrapper for the [IsoCodes Validation library](https://github.com/ronanguilloux/IsoCodes) from\nronanguilloux.\n\n## Installation\n\n### Step 1: Install Through Composer\n\n``` bash\ncomposer require pixelpeter/laravel-isocodes-validation\n```\n\n### Step 2: Add the Service Provider\n\n*(not needed starting with v2.x because of auto discovery)*\n\nAdd the service provider in `app/config/app.php`\n\n```php\n'provider' =\u003e [\n    ...\n    Pixelpeter\\IsoCodesValidation\\IsoCodesValidationServiceProvider::class,\n    ...\n];\n```\n\n## Usage\n\n### Simple examples\n\n```php\n// Checking out your e-commerce shopping cart?\n$payload = [\n    'creditcard' =\u003e '12345679123456'\n];\n$rules = [\n    'creditcard' =\u003e 'creditcard'\n];\n\n$validator = Validator::make($payload, $rules);\n```\n\n### Examples with reference parameter\n\nSome rules need a reference to be validated against (e.g. `country` for `zipcode`).\n\nJust pass the name of the field holding the reference to the rule.\n\n```php\n// Sending letters to the Labrador Islands ?\n$payload = [\n    'zipcode' =\u003e 'A0A 1A0',\n    'country' =\u003e 'CA'\n];\n$rules = [\n    'zipcode' =\u003e 'zipcode:country'\n];\n\n$validator = Validator::make($payload, $rules);\n\n// Publishing books?\n$payload = [\n    'isbn' =\u003e '2-2110-4199-X',\n    'isbntype' =\u003e 13\n];\n$rules = [\n    'zipcode' =\u003e 'isbn:isbntype'\n];\n\n$validator = Validator::make($payload, $rules);\n```\n\n### Example with arrays and dot notation\n\n*(added in v3.x)*\n\nAs suggested by @otr-tomek I've added support for all validation methods using arrays in dot notation as an input.\n\n```php\n$payload = [\n    'data' =\u003e [\n        [\n            'country' =\u003e 'DE',\n            'zipcode' =\u003e 63741\n        ],\n        [\n            'country' =\u003e 'AT',\n            'zipcode' =\u003e 1180\n        ]\n  ] \n];\n\n$validator = Validator::make($payload, [\n    'data.*.zipcode' =\u003e 'zipcode:data.*.country'\n]);\n```\n\n### Validation error messages\n\nError messages can contain the name and value of the field and the value of the reference\n\n```php\n$payload = [\n    'phonenumber' =\u003e 'invalid',\n    'country' =\u003e 'GB'\n];\n$rules = [\n    'phonenumber' =\u003e 'phonenumber:country'\n];\n\n$validator = Validator::make($payload, $rules);\n\nprint $validator-\u003eerrors()-\u003efirst(); // The value \"invalid\" of phonenumber is not valid for \"GB\".\n```\n\n### More Examples\n\nRefer to [IsoCodes Validation library](https://github.com/ronanguilloux/IsoCodes) for more examples and documentation.\n\n## Testing\n\nRun the tests with:\n\n```bash\nvendor/bin/phpunit\n```\n\n## License\n\nGNU General Public License v3.0 only. Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelpeter%2Flaravel-isocodes-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpixelpeter%2Flaravel-isocodes-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpixelpeter%2Flaravel-isocodes-validation/lists"}