internetnextstep/google-places-api

此包最新版本(dev-master)没有提供许可信息。

PHP Google Places API

dev-master 2018-11-22 06:54 UTC

This package is not auto-updated.

Last update: 2024-09-21 09:36:59 UTC


README

注意:此项目可能缺少功能,请发送拉取请求以提供更多使用。

此包允许您连接并从 Google Places API 提取信息。

使用 Google Places API 需要一个 Google API 客户端密钥

特性

安装

使用 Composer 安装包。

运行 composer require tmarois/google-places-api dev-master

基本用法

$client = new \GooglePlaces\Client('YOUR_CLIENT_KEY');

// find all movie theaters in this zip code
$response = $client->placeSearch('textsearch')->setOptions([
    'query' => 'movie theaters in 28202'
])->request();

// get specific place detail information
$placeId  = 'ChIJvznB1hAnVIgRrWFNVdxDHm0';
$response = $client->placeDetails($placeId)->request();

// get a photo found in the previous responses,
// look up by the "photo_reference"
// save the photo locally for caching
$photoId = 'CmRaAAAAoKx6KQyrDEJ0si1ekan0QaZ6Y02NpXwBFa1ncLaKhZECbFa';
$client->placePhotos($photoId,[450,450])->request()->save(__DIR__.'/images');

资源

贡献

接受贡献和反馈。发送任何问题和拉取请求。