PHPackages                             detain/zip-zapper - 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. detain/zip-zapper

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

detain/zip-zapper
=================

Validates Zip/Postal Codes for any country and gives that countries name for thier verions of Zip/Post code

v2.0.0(6y ago)81.5k4[2 PRs](https://github.com/detain/zip-zapper/pulls)MITPHPPHP &gt;=5.4CI failing

Since Mar 22Pushed 3y agoCompare

[ Source](https://github.com/detain/zip-zapper)[ Packagist](https://packagist.org/packages/detain/zip-zapper)[ Docs](https://detain.github.io/zip-zapper)[ RSS](/packages/detain-zip-zapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Zip Zapper
==========

[](#zip-zapper)

Validates Zip / Postal type codes by country with some features

[![Latest Stable Version](https://camo.githubusercontent.com/0e74091bc75ee2693304baf720c4ceb8f298f1b49123ffeafaffbea4ff4e4407/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f76657273696f6e)](https://packagist.org/packages/detain/zip-zapper)[![Total Downloads](https://camo.githubusercontent.com/5664775731e526179b39100497927c0d3496a8f1b28dad01ba878183f5673590/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f646f776e6c6f616473)](https://packagist.org/packages/detain/zip-zapper)[![Latest Unstable Version](https://camo.githubusercontent.com/27165b0f346e887fdeb69d5984676f6b65b3a18665ba2781041520a18068cfe4/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f762f756e737461626c65)](//packagist.org/packages/detain/zip-zapper)[![License](https://camo.githubusercontent.com/85419a792acaa6f5770b17cd1d4969dafcbc7f0e359763f663e7c92e6c069277/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f6c6963656e7365)](https://packagist.org/packages/detain/zip-zapper)[![Monthly Downloads](https://camo.githubusercontent.com/9a7ef0f477dd8dda866b9d72b7d2ec5bf6045ee4209788c42a056eddb77432a3/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f642f6d6f6e74686c79)](https://packagist.org/packages/detain/zip-zapper)[![Daily Downloads](https://camo.githubusercontent.com/f961f41a01655af81a5a6e2cacb35e8af8a734fe36fee710bbc99829c2467cbb/68747470733a2f2f706f7365722e707567782e6f72672f64657461696e2f7a69702d7a61707065722f642f6461696c79)](https://packagist.org/packages/detain/zip-zapper)[![Reference Status](https://camo.githubusercontent.com/4a7619fe5c059cfb41db24db9401c2d5623db3dd9fb138fdf28c3094fe0f346e/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f64657461696e3a7a69702d7a61707065722f7265666572656e63655f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/php/detain:zip-zapper/references)[![Build Status](https://camo.githubusercontent.com/9c95eb09b4239a3834c65592585243869d6d556bbeb568ebc2380196a7662d66/68747470733a2f2f7472617669732d63692e6f72672f64657461696e2f7a69702d7a61707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/detain/zip-zapper)[![Code Climate](https://camo.githubusercontent.com/d48c724c59372d83c0067b69191e893a593a1c9a088bc906554a2ebe906ecb82/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f64657461696e2f7a69702d7a61707065722f6261646765732f6770612e737667)](https://codeclimate.com/github/detain/zip-zapper)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d6ed9615ea0658aa7b5f79b42f3153215e50f3f980124650c887c14093ba1649/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64657461696e2f7a69702d7a61707065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/detain/zip-zapper/?branch=master)[![Codacy Badge](https://camo.githubusercontent.com/f822bcf4725b8dff2c106381f533096f9df24d3995de652b78b225a133567461/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3635393532336636336531363438376561373166366237363339303864303965)](https://www.codacy.com/app/detain/zip-zapper)

[Postal Systems by Country](https://en.wikipedia.org/wiki/Category:Postal_system)
[DMOZ Post/Zip Code Info+DB](http://dmoztools.net/Reference/Directories/Address_and_Phone_Numbers/Postal_Codes/)
[List of Postal Codes](https://en.wikipedia.org/wiki/List_of_postal_codes)

Based on a similar project [sirprize/postal-code-validator](https://github.com/sirprize/postal-code-validator) but expanded on it adding over 100 new validations and updating ther others using mostly the Wikipedia postal codes list and some other features I needed in zip validation.

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

[](#installation)

```
composer require detain/zip-zapper

```

Usage
-----

[](#usage)

### Check If Country Is Supported

[](#check-if-country-is-supported)

```
use Detain\ZipZapper\Validator;

$validator = new Validator();
$validator->hasCountry('CH'); // returns true

```

### Check If Postal Code Is Properly Formatted

[](#check-if-postal-code-is-properly-formatted)

```
use Detain\ZipZapper\Validator;

$validator = new Validator();
$validator->isValid('CH', 'usjU87jsdf'); // returns false
$validator->isValid('CH', '3007'); // returns true

```

### Get The Possible Formats For a Specific Country

[](#get-the-possible-formats-for-a-specific-country)

```
use Detain\ZipZapper\Validator;

$validator = new Validator();
$validator->getFormats('GB'); // returns array('@@## #@@', '@#@ #@@', '@@# #@@', '@@#@ #@@', '@## #@@', '@# #@@')

```

Formatting
----------

[](#formatting)

- `#` = `0-9`
- `@` = `a-zA-Z`

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 92.4% 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 ~427 days

Total

3

Last Release

2482d ago

Major Versions

v1.0.1 → v2.0.02019-07-23

PHP version history (2 changes)v1.0.0PHP &gt;=5.3.2

v2.0.0PHP &gt;=5.4

### Community

Maintainers

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

---

Top Contributors

[![detain](https://avatars.githubusercontent.com/u/1364504?v=4)](https://github.com/detain "detain (133 commits)")[![kumar-interserver](https://avatars.githubusercontent.com/u/29834101?v=4)](https://github.com/kumar-interserver "kumar-interserver (10 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

postal-codevalidationzipcodevalidatorzipzip codecepzipcodepostcodepostal-codeplzcapeircodenpapin codepostal expedition codepostal addressing coddenumro postal dacheminementpostal index numberPostal Routing Numberzone improvement plan

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/detain-zip-zapper/health.svg)

```
[![Health](https://phpackages.com/badges/detain-zip-zapper/health.svg)](https://phpackages.com/packages/detain-zip-zapper)
```

###  Alternatives

[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[ronanguilloux/isocodes

PHP library - Validators for standards from ISO, International Finance, Public Administrations, GS1, Book and Music Industries, Phone numbers &amp; Zipcodes for many countries

8013.3M23](/packages/ronanguilloux-isocodes)[sirprize/postal-code-validator

Validate Formatting Of World-Wide Postal Codes

791.9M1](/packages/sirprize-postal-code-validator)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[opis/json-schema

Json Schema Validator for PHP

64236.9M185](/packages/opis-json-schema)[uvinum/zipcodevalidator

Library to validate worldwide zipcodes

14115.7k1](/packages/uvinum-zipcodevalidator)

PHPackages © 2026

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