PHPackages                             barbieswimcrew/zip-code-validator - 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. barbieswimcrew/zip-code-validator

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

barbieswimcrew/zip-code-validator
=================================

Constraint class for international zipcode validation

v3.2.0(3mo ago)772.3M↓13.8%21MITPHPPHP &gt;=8.0CI passing

Since Aug 5Pushed 3mo ago3 watchersCompare

[ Source](https://github.com/barbieswimcrew/zip-code-validator)[ Packagist](https://packagist.org/packages/barbieswimcrew/zip-code-validator)[ RSS](/packages/barbieswimcrew-zip-code-validator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (35)Used By (0)

Constraint Class for international Zipcode Validation
=====================================================

[](#constraint-class-for-international-zipcode-validation)

[![Build Status](https://github.com/barbieswimcrew/zip-code-validator/actions/workflows/ci.yaml/badge.svg)](https://github.com/barbieswimcrew/zip-code-validator/actions/workflows/ci.yaml)[![Downloads](https://camo.githubusercontent.com/425afd6ee4a429f034acea3af31cde88b4c3aa148147797015975f815fd7a1af/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261726269657377696d637265772f7a69702d636f64652d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/barbieswimcrew/zip-code-validator)[![Latest stable version](https://camo.githubusercontent.com/0928f22434e35c6592c415a1896d830e2ed3ce14fc52d257a99a6f9696d4822b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261726269657377696d637265772f7a69702d636f64652d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/barbieswimcrew/zip-code-validator)[![PHP from Packagist](https://camo.githubusercontent.com/5452b909966a31af7fb53d521e4f35cabf0178bbb93635f79ab1f9db9dabb971/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6261726269657377696d637265772f7a69702d636f64652d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](./composer.json)[![GitHub stars](https://camo.githubusercontent.com/bff8ae80c35be3f7a357c580dc46fab478b904453250c83493c74177414133df/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6261726269657377696d637265772f7a69702d636f64652d76616c696461746f722e7376673f7374796c653d666c61742d737175617265266c6162656c3d5374617273267374796c653d666c61742d737175617265)](https://github.com/barbieswimcrew/zip-code-validator/stargazers)[![MIT licensed](https://camo.githubusercontent.com/26a2621db0df54f50a1e110b8a5f736acb98f082c6ce26079951994773239b6e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6261726269657377696d637265772f7a69702d636f64652d76616c696461746f722e7376673f7374796c653d666c61742d737175617265)](https://github.com/barbieswimcrew/zip-code-validator/blob/master/LICENSE)

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

[](#installation)

This package uses Composer, please checkout the [composer website](https://getcomposer.org) for more information.

The following command will install `zip-code-validator` into your project. It will also add a new entry in your `composer.json` and update the `composer.lock` as well.

```
$ composer require barbieswimcrew/zip-code-validator
```

> This package follows the PSR-4 convention names for its classes, which means you can easily integrate `zip-code-validator` classes loading in your own autoloader.

What now?
---------

[](#what-now)

For validating a zip code you need to instantiate a new ZipCode class provided by this package to set it as a constraint to your form field, for example:

```
