定制 upgradelabs/swiss-zip-code-resolver 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

upgradelabs/swiss-zip-code-resolver

最新稳定版本:1.0

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 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

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

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.

统计信息

  • 总下载量: 118
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2025-12-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固