承接 insight-media/google-geocoding 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

insight-media/google-geocoding

最新稳定版本:v0.0.5

Composer 安装命令:

composer require insight-media/google-geocoding

包简介

Google Geocoding API integration for Laravel

README 文档

README

This package provides a wrapper around Google Geocoding API for your Laravel application.

Installation

1. Require via composer

Add the insight-media/google-geocoding Composer dependency to your project.

composer require insight-media/google-geocoding

2. Register Service Provider

Open config/app.php and append providers array with:

InsightMedia\Geocoding\GeocodingServiceProvider::class

Usage

Singleton

Geocoder is register as singleton in Laravel's Service Container making it easy to call it
anywhere within your application. Simply 'make' Geocoder with app helper method.

app('Geocoder')

Fluent API

Geocoder provides a fluent API for every available parameter in geocoding request.

app('Geocoder')->address('stadiou 14')
               ->language('el')
               ->region('gr')
               ->geocode()

You can also pass an array of parameters

app('Geocoder')->parameters([
                  'address'  => 'stadiou 14'
                  'language' => 'el'
                  'region'   => 'gr'
                ])
               ->geocode()

Note: Key will be set from config file. Any value passed with parameters method will be overwritten.
More about available parameters you can find at Google Geocoding Documentation.

Configuration

Api Key

In order to start using Google Geocoding API you must obtain first an API key.
After getting your API key publish Geocoder's configuration file and make necessary changes.

php artisan vendor:publish --tag=geocoding-config

A config file with name geocoding.php will be created.

return [

    /*
   |--------------------------------------------------------------------------
   | Application Key
   |--------------------------------------------------------------------------
   |
   | Your application's API key. Make sure to get a Key before starting using
   | Google Geocoding API.
   |
   */

    'api_key' => '',

    /*
    |--------------------------------------------------------------------------
    | Google Maps Geocoding API URL
    |--------------------------------------------------------------------------
    |
    | Here you san set the URL for the Google Maps Geocoding API. By default,
    | HTTPS protocol has been selected.
    |
    */

    'request_url' => 'https://maps.googleapis.com/maps/api/geocode/',

    /*
    |--------------------------------------------------------------------------
    | Response Output Format
    |--------------------------------------------------------------------------
    |
    | Here you can configure the preferred output format of a Geocoding
    | Request.
    |
    | Supported: "json", "xml"
    |
    */

    'output_format' => 'json',
];

##License

This package is released under the MIT License.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-02-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固