tmarois/google-places-api

此包已被弃用且不再维护。未建议替代包。
此包的最新版本(dev-master)没有可用的许可证信息。

PHP Google 地点 API

dev-master 2018-05-15 13:49 UTC

This package is not auto-updated.

Last update: 2023-01-21 20:30:28 UTC


README

注意:该项目可能缺少一些功能,请发送拉取请求以添加更多使用功能。

此包允许您连接并从 Google 地点 API 拉取信息

您需要 Google 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');

资源

贡献

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