PHPackages                             ganti/swisszip - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ganti/swisszip

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ganti/swisszip
==============

Get village by Postleitzahl (ZIP-Code)

101PHPCI failing

Since Dec 31Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/ganti/swissZIP)[ Packagist](https://packagist.org/packages/ganti/swisszip)[ RSS](/packages/ganti-swisszip/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)DependenciesVersions (1)Used By (0)

swissZIP (Schweizer Postleitzahlen API)
=======================================

[](#swisszip-schweizer-postleitzahlen-api)

Get town by Postleitzahl (ZIP-Code)

Test it here:

[![UpdateZIP](https://github.com/ganti/swissZIP/actions/workflows/updateZIP.yml/badge.svg?branch=main)](https://github.com/ganti/swissZIP/actions/workflows/updateZIP.yml)

Query
-----

[](#query)

`/zip.php?zip=3073&format=(json|xml|debug)&canton=BE`

categorytypevaluedescriptionzip4 digit number1000-9999Postleitzahl/ ZIP-Codeformatstringjson; xml; debugoutput formatcantonstringe.g AG, GR, ZHfilter by cantonscopestringmunicipality, towndefault: municipality; If town (Ortschaft) is set the grouping changes. there can be multiple towns within one municipality (Gemeinde) or multiple municipalities within a town. As example try both params with zip [7415](https://swisszip.api.ganti.dev/zip/7415?scope=town)Response
--------

[](#response)

categorytypevaluedescriptionstatuscountnumberhow many resultsstatusdistinct0 or 1there was exactly one resultstatusstatus'ok' or 'error'general information if request was successfulstatuserror\['name'\]stringerrorstatuserror\['description'\]stringdescription of errordatazip4 digit numberPostleitzahl/ ZIP-Codedatabfs4 digit numberGemeindeNummer, Official municipality IDdatatownstringName of town (Ortschaft)datamunicipalitystringName of municipality (official municipality name)datazip-sharenumberpercentage of areadatalocalestringde, fr, it, rm```
   [status] => Array
        (
            [status] => ok
            [count] => 4
            [distinct] => 0
        )

    [data] => Array
        (
            [0] => Array
                (
                    [zip] => 3073
                    [zip-share] => 99.06
                    [town] => Gümligen
                    [bfs] => 356
                    [municipality] => Muri bei Bern
                    [canton] => BE
                    [locale] => de
                )

            [1] => Array
                (
                    [zip] => 3073
                    [zip-share] => 0.58
                    [town] => Gümligen
                    [bfs] => 351
                    [municipality] => Bern
                    [canton] => BE
                    [locale] => de
                )

            [2] => Array
                (
                    [zip] => 3073
                    [zip-share] => 0.31
                    [town] => Gümligen
                    [bfs] => 363
                    [municipality] => Ostermundigen
                    [canton] => BE
                    [locale] => de
                )

            [3] => Array
                (
                    [zip] => 3073
                    [zip-share] => 0.04
                    [town] => Gümligen
                    [bfs] => 630
                    [municipality] => Allmendingen
                    [canton] => BE
                    [locale] => de
                )

        )
```

Datasource
----------

[](#datasource)

from the official commune register

- [https://data.geo.admin.ch/ch.swisstopo-vd.ortschaftenverzeichnis\_plz](https://data.geo.admin.ch/ch.swisstopo-vd.ortschaftenverzeichnis_plz)
-

CC0 License
-----------

[](#cc0-license)

CC0-1.0 2019-2024 github.com/ganti

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDi WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance54

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity12

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/944a6adcd9f8a2c521d242472278a4bc81de512bc2e0abac3c17bba8f3d4725c?d=identicon)[ganti](/maintainers/ganti)

---

Top Contributors

[![ganti](https://avatars.githubusercontent.com/u/28899559?v=4)](https://github.com/ganti "ganti (677 commits)")[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (1 commits)")

### Embed Badge

![Health badge](/badges/ganti-swisszip/health.svg)

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

###  Alternatives

[pwm/datetime-period

An implementation of the datetime period type for working with temporal intervals

679.0k](/packages/pwm-datetime-period)

PHPackages © 2026

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