定制 greeneh/postcode 二次开发

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

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

greeneh/postcode

Composer 安装命令:

composer require greeneh/postcode

包简介

Unified search for postcodes across various different providers.

README 文档

README

Simple searching for postcodes to retrieve geographic information. Support for various API providers and a unified address/output format.

Installation

With composer - add to your requires section:

  • "greeneh/postcode": "~0.0.1"

Laravel Specific

Add the following to your config/app.php

  1. providers array:

'Greeneh\Postcode\PostcodeServiceProvider',

  1. aliases array

'Postcode' => 'Greeneh\Postcode\Facades\Postcode',

Usage

Retrieving geograhic information from a postcode:

Postcode::search('E16 1FW')

Result from using the Google API Provider

object(Greeneh\Postcode\Address)[282]
  protected 'fillable' => 
    array (size=6)
      0 => string 'town' (length=4)
      1 => string 'city' (length=4)
      2 => string 'county' (length=6)
      3 => string 'latitude' (length=8)
      4 => string 'longitude' (length=9)
      5 => string 'source' (length=6)
  protected 'attributes' => 
    array (size=6)
      'town' => null
      'city' => string 'London' (length=6)
      'county' => string 'Greater London' (length=14)
      'latitude' => float 51.5166391
      'longitude' => float 0.0210837
      'source' => 
        object(stdClass)[246]
          public 'results' => 
            array (size=1)
              0 => 
                object(stdClass)[250]
                  public 'address_components' => 
                    array (size=6)
                      0 => 
                        object(stdClass)[232]
                          public 'long_name' => string 'E16 1FW' (length=7)
                          public 'short_name' => string 'E16 1FW' (length=7)
                          public 'types' => 

Get the lat/lng from a postcode

Postcode::getCoordinates('E16 1FW')

Result

array (size=2)
  'latitude' => float 51.6359841
  'longitude' => float 0.2919168

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2014-09-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固