PHPackages                             upgradelabs/swiss-zip-code-resolver - 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. upgradelabs/swiss-zip-code-resolver

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

upgradelabs/swiss-zip-code-resolver
===================================

A resolver for Swiss zip codes (PLZ).

1.0(4mo ago)097↓50%Apache-2.0PHPPHP &gt;=5.6.0

Since Dec 16Pushed 4mo agoCompare

[ Source](https://github.com/upgradelabs/SwissZipCodeResolver)[ Packagist](https://packagist.org/packages/upgradelabs/swiss-zip-code-resolver)[ Docs](https://github.com/upgradelabs/SwissZipCodeResolver)[ RSS](/packages/upgradelabs-swiss-zip-code-resolver/feed)WikiDiscussions main Synced 1mo ago

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

> ⚠️ This project is a fork of onlime/swiss-zip-code-resolver

Onlime's Swiss Zip Code Resolver
================================

[](#onlimes-swiss-zip-code-resolver)

Copyright (c) Onlime GmbH,

A simple zip code lookup library to get information like city, commune, canton, and coordinates (LV03) for a Swiss zip code (PLZ).

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

[](#installation)

PHP versions 5.6 up to PHP 7.1 are currently supported.

The [zip](http://php.net/zip) extension is required. PHP should be compiled with zip support by using the `--enable-zip` configure option.

It is recommended to use [Composer](https://getcomposer.org) to install the library.

```
$ composer require upgradelabs/swiss-zip-code-resolver
```

You can also use any other [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant autoloader.

Usage
-----

[](#usage)

- Create `Resolver` object

```
$Resolver = new Upgradelabs\SwissZipCodeResolver\Resolver();

```

- Call `lookup()` method

```
$Result = $Resolver->lookup($zipcode);

```

- Sample of a `Result` object:

```
Upgradelabs\SwissZipCodeResolver\Result Object
(
    [zipcode] => 8046
    [city] => Zürich
    [extraDigit] => 0
    [commune] => Zürich
    [bfsNr] => 261
    [canton] => ZH
    [east] => 680711
    [north] => 252925
    [validZipCode] => 1
)

```

- You may choose from 5 different return types. The types are array, object, json, serialize and xml. By default it is object. If you want to change that call the format method before calling the parse method or provide the format to the constructor. If you are not using object and an error occurs, then exceptions will not be trapped within the response and thrown directly.

```
$Resolver->setFormat('json');
$Resolver = new Upgradelabs\SwissZipCodeResolver\Resolver('json');

```

- The `Resolver` supports the fluent interface on its setters, e.g.:

```
$Resolver = new Upgradelabs\SwissZipCodeResolver\Resolver();
$Resolver
    ->setCachePath('/tmp')
    ->setCacheTime(86400)
    ->setFormat('json');
$json = $Resolver->lookup(8046);

```

Credits
-------

[](#credits)

The data is provided and updated by GEO.ADMIN.CH:

- [GEO.ADMIN.CH - Geoinformationsplattform der Schweizerischen Eidgenossenschaft](http://data.geo.admin.ch/)
- [Schweizerisches Katasterwesen - Amtliches Ortschaftenverzeichnis](https://www.cadastre.ch/de/services/service/plz.html)
- [PLZO\_CSV\_LV03.zip](http://data.geo.admin.ch/ch.swisstopo-vd.ortschaftenverzeichnis_plz/PLZO_CSV_LV03.zip)

Issues
------

[](#issues)

Please report any issues via

LICENSE and COPYRIGHT
---------------------

[](#license-and-copyright)

Copyright (c) 2007 - 2016 Onlime Webhosting ()

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance78

Regular maintenance activity

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

143d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

phpzip codezipcodepostal-codeswitzerlandswissplz

### Embed Badge

![Health badge](/badges/upgradelabs-swiss-zip-code-resolver/health.svg)

```
[![Health](https://phpackages.com/badges/upgradelabs-swiss-zip-code-resolver/health.svg)](https://phpackages.com/packages/upgradelabs-swiss-zip-code-resolver)
```

###  Alternatives

[barbieswimcrew/zip-code-validator

Constraint class for international zipcode validation

772.3M](/packages/barbieswimcrew-zip-code-validator)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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