定制 baspa/zip-code-location-lookup 二次开发

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

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

baspa/zip-code-location-lookup

最新稳定版本:v0.2.0

Composer 安装命令:

composer require baspa/zip-code-location-lookup

包简介

y

README 文档

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package allows you to lookup the geographic location of a zip code by combining the Postcode.tech API with the Google Geocoding API.

Installation

You can install the package via composer:

composer require baspa/zip-code-location-lookup

Then add the Google Maps API and Postcode.tech API keys to your .env file:

GOOGLE_MAPS_API_KEY=your_api_key
POSTCODE_TECH_API_KEY=your_api_key

Then add those keys to the services.php config file:

return [

    // ...

    'google' => [
        'api_key' => env('GOOGLE_MAPS_API_KEY'),
    ],

    'postcode_tech' => [
        'api_key' => env('POSTCODE_TECH_API_KEY'),
    ],
];

Usage

use Baspa\ZipCodeLocationLookup\ZipCodeLocationLookup;

// With Google Maps integration (default)
$lookup = new ZipCodeLocationLookup();

// Without Google Maps integration
$lookup = new ZipCodeLocationLookup(false);

// Lookup a zip code
$result = $lookup->lookup(zipCode: '1011AB', number: 1);

// Returns an array containing:
// - postcode: The normalized postcode
// - street: Street name
// - city: City name
// - municipality: Municipality name
// - province: Province name
// - lat: Latitude coordinate
// - lng: Longitude coordinate
$result = [
    'postcode' => '1011 AB',
    'street' => 'Dam',
    'city' => 'Amsterdam',
    'municipality' => 'Amsterdam',
    'province' => 'Noord-Holland',
    'lat' => 52.373169,
    'lng' => 4.893379
];

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固