{"id":43146774,"url":"https://github.com/php-collective/google-maps-services","last_synced_at":"2026-01-31T23:48:26.670Z","repository":{"id":223393072,"uuid":"760200533","full_name":"php-collective/google-maps-services","owner":"php-collective","description":"PHP client library(SDK) for Google Maps API Web Services","archived":false,"fork":false,"pushed_at":"2024-02-20T01:23:24.000Z","size":27,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-02-20T02:26:33.533Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-collective.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-20T01:05:40.000Z","updated_at":"2024-02-20T02:26:40.771Z","dependencies_parsed_at":"2024-02-20T02:26:36.055Z","dependency_job_id":"b5e69e2e-cc89-4db2-a12a-24ba09127297","html_url":"https://github.com/php-collective/google-maps-services","commit_stats":null,"previous_names":["php-collective/google-maps-services"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/php-collective/google-maps-services","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fgoogle-maps-services","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fgoogle-maps-services/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fgoogle-maps-services/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fgoogle-maps-services/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-collective","download_url":"https://codeload.github.com/php-collective/google-maps-services/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fgoogle-maps-services/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28961124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T23:03:11.038Z","status":"ssl_error","status_checked_at":"2026-01-31T22:56:44.691Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-31T23:48:25.914Z","updated_at":"2026-01-31T23:48:26.660Z","avatar_url":"https://github.com/php-collective.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://cloud.google.com/maps-platform/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://cloud.google.com/images/maps-platform/google-maps-lockup.svg\" width=\"300px\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eGoogle Maps Services \u003ci\u003efor\u003c/i\u003e PHP\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\nPHP client library(SDK) for Google Maps API Web Services\n\n[![Latest Stable Version](https://poser.pugx.org/php-collective/google-maps-services/v/stable?format=flat-square)](https://packagist.org/packages/php-collective/google-maps-services)\n[![License](https://poser.pugx.org/php-collective/google-maps-services/license?format=flat-square)](https://packagist.org/packages/php-collective/google-maps-services)\n[![Total Downloads](https://poser.pugx.org/php-collective/google-maps-services/downloads?format=flat-square)](https://packagist.org/packages/php-collective/google-maps-services)\n[![Monthly Downloads](https://poser.pugx.org/php-collective/google-maps-services/d/monthly?format=flat-square)](https://packagist.org/packages/php-collective/google-maps-services)\n\n\nOUTLINE\n-------\n\n- [Demonstration](#demonstration)\n- [Description](#description)\n- [Requirements](#requirements)\n    - [API keys](#api-keys)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [Client](#client)\n        - [Google Maps APIs Premium Plan license](#google-maps-apis-premium-plan-license)\n        - [Language](#language)\n    - [Directions API](#directions-api)\n    - [Distance Matrix API](#distance-matrix-api)\n    - [Routes API](#routes-api)\n    - [Elevation API](#elevation-api)\n    - [Geocoding API](#geocoding-api)\n    - [Geolocation API](#geolocation-api)\n    - [Time Zone API](#time-zone-api)\n\n---\n\nDEMONSTRATION\n-------------\n\n\n```php\n$gmaps = new \\yidas\\googleMaps\\Client(['key'=\u003e'Your API Key']);\n\n// Geocoding an address\n$geocodeResult = $gmaps-\u003egeocode('Taipei 101, Taipei City, Taiwan 110');\n\n// Look up an address with reverse geocoding\n$reverseGeocodeResult = $gmaps-\u003ereverseGeocode([25.0339639, 121.5644722]);\n\n// Request directions via public transit\n$directionsResult = $gmaps-\u003edirections('National Palace Museum', 'Taipei 101', [\n    'mode' =\u003e \"transit\",\n    'departure_time' =\u003e time(),\n    ]);\n```\n\n---\n\n\nDESCRIPTION\n-----------\n\nThe PHP Client for Google Maps Services is a PHP Client library for the following Google Maps APIs:\n\n - [Directions API]\n - [Distance Matrix API]\n - [Elevation API]\n - [Geocoding API]\n - [Geolocation API]\n - [Time Zone API]\n - [Roads API] (Required)\n - [Places API] (Required)\n\n---\n\nREQUIREMENTS\n------------\n\n### API keys\n\nEach Google Maps Web Service request requires an API key or client ID. API keys\nare freely available with a Google Account at\nhttps://developers.google.com/console. The type of API key you need is a\n**Server key**.\n\nTo get an API key:\n\n 1. Visit https://developers.google.com/console and log in with\n    a Google Account.\n 2. Select one of your existing projects, or create a new project.\n 3. Enable the API(s) you want to use. The Client for Google Maps Services\n    accesses the following APIs:\n    * Directions API\n    * Distance Matrix API\n    * Routes API\n    * Elevation API\n    * Geocoding API\n    * Geolocation API\n    * Places API\n    * Roads API\n    * Time Zone API\n 4. Create a new **Server key**.\n 5. If you'd like to restrict requests to a specific IP address, do so now.\n\nFor guided help, follow the instructions for the [Directions API][directions-key]. You only need one API key, but remember to enable all the APIs you need.\nFor even more information, see the guide to [API keys][apikey].\n\n**Important:** This key should be kept secret on your server.\n\n---\n\nINSTALLATION\n------------\n\nRun Composer in your project:\n\n    composer require php-collective/google-maps-services\n\nThen you could call it after Composer is loaded depended on your PHP framework:\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse yidas\\googleMaps\\Client;\n```\n\n---\n\nUSAGE\n-----\n\nBefore using any Google Maps Services, first you need to create a Client with configuration, then use the client to access Google Maps Services.\n\n### Client\n\nCreate a Client using [API key]((#api-keys)):\n\n```php\n$gmaps = new \\yidas\\googleMaps\\Client(['key'=\u003e'Your API Key']);\n```\n\n#### Google Maps APIs Premium Plan license\n\nIf you use [Google Maps APIs Premium Plan license](https://developers.google.com/maps/documentation/directions/get-api-key#client-id) instead of an API key, you could create Client using client ID and client secret (digital signature) for authentication.\n\n```php\n$gmaps = new \\yidas\\googleMaps\\Client([\n    'clientID' =\u003e 'Your client ID',\n    'clientSecret' =\u003e 'Your digital signature'\n    ]);\n```\n\n#### Language\n\nYou could set language for Client for all services:\n\n```php\n$gmaps = new \\yidas\\googleMaps\\Client(['key'=\u003e'Your API Key', 'language'=\u003e'zh-TW']);\n```\n\nChanging language during execution:\n\n```php\n$gmaps-\u003esetLanguage('zh-TW');\n// ...\n```\n\n### Directions API\n\n```php\n// Request directions via public transit\n$directionsResult = $gmaps-\u003edirections('National Palace Museum', 'Taipei 101', [\n    'mode' =\u003e \"transit\",\n    'departure_time' =\u003e time(),\n    ]);\n```\n\n\n### Distance Matrix API\n\n```php\n// Get the distance matrix data between two places\n$distanceMatrixResult = $gmaps-\u003edistanceMatrix('National Palace Museum', 'Taipei 101');\n\n// With Imperial units\n$distanceMatrixResult = $gmaps-\u003edistanceMatrix('National Palace Museum', 'Taipei 101', [\n    'units' =\u003e 'imperial',\n    ]);\n```\n\n### Routes API\n\n```php\n// Get the distance matrix data between two places\n$route = $gmaps-\u003eroute($from, $to, $params);\n```\n\n### Elevation API\n\n```php\n// Get elevation by locations parameter\n$elevationResult = $gmaps-\u003eelevation([25.0339639, 121.5644722]);\n$elevationResult = $gmaps-\u003eelevation('25.0339639, 121.5644722');\n```\n\n### Geocoding API\n\n```php\n// Geocoding an address\n$geocodeResult = $gmaps-\u003egeocode('Taipei 101, Taipei City, Taiwan 110');\n\n// Look up an address with reverse geocoding\n$reverseGeocodeResult = $gmaps-\u003ereverseGeocode([25.0339639, 121.5644722]);\n```\n\n### Geolocation API\n\n```php\n// Simple geolocate\n$geolocateResult = $gmaps-\u003egeolocate([]);\n```\n\n### Time Zone API\n\n```php\n// requests the time zone data for giving location\n$timezoneResult = $gmaps-\u003etimezone([25.0339639, 121.5644722]);\n```\n\n\n\n[Google Maps API Web Services]: https://developers.google.com/maps/documentation/webservices/\n[Directions API]: https://developers.google.com/maps/documentation/directions/\n[directions-key]: https://developers.google.com/maps/documentation/directions/get-api-key#key\n[directions-client-id]: https://developers.google.com/maps/documentation/directions/get-api-key#client-id\n[Distance Matrix API]: https://developers.google.com/maps/documentation/distancematrix/\n[Elevation API]: https://developers.google.com/maps/documentation/elevation/\n[Geocoding API]: https://developers.google.com/maps/documentation/geocoding/\n[Geolocation API]: https://developers.google.com/maps/documentation/geolocation/\n[Time Zone API]: https://developers.google.com/maps/documentation/timezone/\n[Roads API]: https://developers.google.com/maps/documentation/roads/\n[Places API]: https://developers.google.com/places/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Fgoogle-maps-services","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-collective%2Fgoogle-maps-services","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Fgoogle-maps-services/lists"}