定制 peoplegogo/google-places 二次开发

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

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

peoplegogo/google-places

最新稳定版本:1.0.3

Composer 安装命令:

composer require peoplegogo/google-places

包简介

A PHP wrapper for the Google Places API.

关键字:

README 文档

README

Latest Stable Version License Build Status

Logo of Google Places API Web Service

This is a PHP wrapper for Google Places API Web Service.

Installation

Composer

The recommended installation method is through Composer. Add to your composer.json file:

{
    "require": {
        "peoplegogo/google-places": "~1.0"
    }
}

or with the following command from your browser:

composer require peoplegogo/google-places

Check in Packagist.

Manually

Steps:

  • Copy src/GooglePlaces.php to your codebase, perhaps to the vendor directory.
  • Add the GooglePlaces class to your autoloader or require the file directly.

Getting Started

First you have to create an instance of GooglePlaces:

$google_places = new GooglePlaces();

You can pass the API key (used to authenticate in front of Google service) during the creation of the instance or you can set it up later.

$google_places = new GooglePlaces($apiKey);

or

$google_places = new GooglePlaces();
$google_places->setApiKey($apiKey);

By default, the format is set to json but you can change it that way:

$google_places = new GooglePlaces($apiKey, $format);

or

$google_places->setFormat($format);

You can also set up the language if you want.

$google_places->setLanguage($language_code);

In this way it won't be necessary to set up the language within every request.

You can also prepare the input parameters:

$params = [
	'input' => 'Vict',
	'types' => '(cities)',
	'language' => 'pt_BR' 
];

Once all parameters are set, the final step is to send the request to the Google Places Api:

$results = $google_places->getAutocomplete($params);

The result is an array. The GooglePlaces class decodes the response received from Google, so it is not necessary for you to do that.

For more information for the methods and the features of the library you can check "src" or "tests" folders.

Contributing

How can you contribute:

  1. Fork it.
  2. Create your feature branch (git checkout -b my-new-feature).
  3. Commit your changes (git commit -am 'Added some feature').
  4. Push to the branch (git push origin my-new-feature).
  5. Create a new Pull Request.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固