定制 shiishiji/google-places-sdk 二次开发

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

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

shiishiji/google-places-sdk

最新稳定版本:1.1.2

Composer 安装命令:

composer require shiishiji/google-places-sdk

包简介

README 文档

README

Official google API documentation -> here

Installation

composer require shiishiji/google-places-sdk

Usage

  1. Get your access token and create Configuration object
use Shiishiji\GooglePlacesSDK\Config\Configuration;

$configuration = new Configuration(
    authToken: 'this-is-place-for-your-token', 
);
  1. Instantiate facade class
use Shiishiji\GooglePlacesSDK\GooglePlacesFacade;
use Shiishiji\GooglePlacesSDK\Client\JsonClientFactory;
use Shiishiji\GooglePlacesSDK\Transformer\TransformerContext;
use Shiishiji\GooglePlacesSDK\Transformer\NearbySearchFiltersTransformer;

$facade = new GooglePlacesFacade(
    configuration: $configuration,
)
  1. Examples

Execute Nearby Search request

use Shiishiji\GooglePlacesSDK\DTO\Input\NearbySearchFilters;
use Shiishiji\GooglePlacesSDK\DTO\Location;

$facade->getNearbyPlaces(new NearbySearchFilters(
    location: new Location(lat: '40', lng: '-110'),
    language: 'en',
    radius: 4000, 
));

Execute Find Place From Text request

use Shiishiji\GooglePlacesSDK\DTO\Input\FindPlaceByTextFilters;
use Shiishiji\GooglePlacesSDK\DTO\Input\Partials\Fields;

$facade->getPlacesFromText(new FindPlaceByTextFilters(
    input: 'Museum of Contemporary Art Australia',
    inputType: 'textquery',
    fields: new Fields([Fields::FORMATTED_ADDRESS, Fields::PLACE_ID]),
    locationBias: 'ipbias',
    language: 'en',
));

Development

Before any of command below, docker image must be build

docker build -t google-places-sdk . 

Install dependencies

docker run --rm -t -v $PWD:/app google-places-sdk composer install

Run tests

docker run --rm -t -v $PWD:/app google-places-sdk vendor/bin/phpspec run

Run PHP CS fixer

docker run --rm -t -v $PWD:/app google-places-sdk vendor/bin/php-cs-fixer fix

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2022-08-11