upgradelabs/swiss-zip-code-resolver
Composer 安装命令:
composer require upgradelabs/swiss-zip-code-resolver
包简介
A resolver for Swiss zip codes (PLZ).
README 文档
README
⚠️ This project is a fork of onlime/swiss-zip-code-resolver
Onlime's Swiss Zip Code Resolver
Copyright (c) Onlime GmbH, https://www.onlime.ch
A simple zip code lookup library to get information like city, commune, canton, and coordinates (LV03) for a Swiss zip code (PLZ).
Installation
PHP versions 5.6 up to PHP 7.1 are currently supported.
The zip extension is required. PHP should be compiled with zip support by using the --enable-zip configure option.
It is recommended to use Composer to install the library.
$ composer require upgradelabs/swiss-zip-code-resolver
You can also use any other PSR-4 compliant autoloader.
Usage
- Create
Resolverobject
$Resolver = new Upgradelabs\SwissZipCodeResolver\Resolver();
- Call
lookup()method
$Result = $Resolver->lookup($zipcode);
- Sample of a
Resultobject:
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
Resolversupports 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
The data is provided and updated by GEO.ADMIN.CH:
- GEO.ADMIN.CH - Geoinformationsplattform der Schweizerischen Eidgenossenschaft
- Schweizerisches Katasterwesen - Amtliches Ortschaftenverzeichnis
- PLZO_CSV_LV03.zip
Issues
Please report any issues via https://github.com/Upgradelabs/SwissZipCodeResolver/issues
LICENSE and COPYRIGHT
Copyright (c) 2007 - 2016 Onlime Webhosting (https://www.onlime.ch)
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
http://www.apache.org/licenses/LICENSE-2.0
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.
upgradelabs/swiss-zip-code-resolver 适用场景与选型建议
upgradelabs/swiss-zip-code-resolver 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 194 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 12 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「zipcode」 「zip code」 「postal code」 「switzerland」 「swiss」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 upgradelabs/swiss-zip-code-resolver 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 upgradelabs/swiss-zip-code-resolver 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 upgradelabs/swiss-zip-code-resolver 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Allow packages to be installed from a repository or tarball bundle that have multiple packages in the sub-folders
Iteration tools for PHP
Validates Zip/Postal Codes for any country and provides each country's localized name for their version of the Zip/Postal code (CEP, PLZ, PIN code, Eircode, NPA, CAP, ZIP code, etc.).
Symfony bundle for Geonames API
Convert and operate with FIPS codes for states, counties, etc.
Smart compressed files extractor
统计信息
- 总下载量: 194
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 31
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-12-16