承接 gplacesphp/api-client 相关项目开发

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

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

gplacesphp/api-client

Composer 安装命令:

composer require gplacesphp/api-client

包简介

Modern Google Places API client for PHP

README 文档

README

Packagist PHP from Packagist Packagist

Build status

Version Linux build Windows build
v1 (master) Travis (.org) branch AppVeyor branch

Introduction

Modern, Object-Oriented, client for using Google's Places API, requires PHP v7.1+. Any PSR-7 (HTTP Message Interface) and PSR-17 (HTTP Factories) implementations is supported (and required). Supports caching by any PSR-16 (simple cache) implementation, also works with any HTTPlug client/adapter.

Installation

composer require gplacesphp/api-client

Usage

This examples uses php-http/guzzle6-adapter as a PSR-18 implementation and zendframework/zend-diactoros as a PSR-7/PSR-17 implementation. Any other PSR-7/PSR-17/PSR-18 implementations are supported. If you don't have them installed you will need to run:

composer require \
    guzzlehttp/guzzle \
    php-http/guzzle6-adapter \
    zendframework/zend-diactoros

Remember to replace <YOUR_API_KEY> with you key.

More usage examples are in examples directory.

Place details

Basic example

<?php

require_once __DIR__ . '/vendor/autoload.php';

$apiKey = '<YOUR_API_KEY>';
$guzzle = new \GuzzleHttp\Client();
$httpClient = new \Http\Adapter\Guzzle6\Client($guzzle);
$requestFactory = new \Zend\Diactoros\RequestFactory();

$client = \GPlacesPhp\ApiClient\Client::create(
    $apiKey,
    $httpClient,
    $requestFactory
);

$placeDetails = $client->placeDetails('ChIJAZ-GmmbMHkcR_NPqiCq-8HI'); // Warsaw

var_dump($placeDetails);

Find place

Basic example

<?php

require_once __DIR__ . '/vendor/autoload.php';

$apiKey = '<YOUR_API_KEY>';
$guzzle = new \GuzzleHttp\Client();
$httpClient = new \Http\Adapter\Guzzle6\Client($guzzle);
$requestFactory = new \Zend\Diactoros\RequestFactory();

$client = \GPlacesPhp\ApiClient\Client::create(
    $apiKey,
    $httpClient,
    $requestFactory
);

$findPlace = $client->findPlace('Warszawa, Polska'); // Warsaw

var_dump($findPlace);

TODOs

Things to do before stable v1 release:

  • Place Details
  • Caching Place Details
  • Places Search
    • Find Place
    • Nearby Search
    • Text Search
  • Caching Places Search
    • Find Place
    • Nearby Search
    • Text Search
  • Place Photos
  • Caching Place Photos
  • Use PSR-18 instead of HTTPlug

License

This package is free software distributed under the terms of the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固