{"id":23489946,"url":"https://github.com/sachinagarwal1337/google-places-api","last_synced_at":"2026-04-02T13:58:47.086Z","repository":{"id":55028919,"uuid":"51136677","full_name":"SachinAgarwal1337/google-places-api","owner":"SachinAgarwal1337","description":"This is a PHP wrapper for Google Places API Web Service. And is Laravel Framework friendly.","archived":false,"fork":false,"pushed_at":"2025-02-27T05:24:57.000Z","size":87,"stargazers_count":188,"open_issues_count":2,"forks_count":45,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-05-12T07:41:40.009Z","etag":null,"topics":["google","google-api","google-places","google-places-api","laravel","laravel-google-places","laravel-google-places-api","places"],"latest_commit_sha":null,"homepage":"","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/SachinAgarwal1337.png","metadata":{"files":{"readme":"README-Legacy.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"SachinAgarwal1337","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":"sachin1337","custom":null}},"created_at":"2016-02-05T09:08:31.000Z","updated_at":"2025-04-10T11:28:11.000Z","dependencies_parsed_at":"2024-03-11T18:29:34.826Z","dependency_job_id":"cfe7e92c-211f-43b0-86f1-769f2c63ce98","html_url":"https://github.com/SachinAgarwal1337/google-places-api","commit_stats":{"total_commits":46,"total_committers":12,"mean_commits":"3.8333333333333335","dds":0.4347826086956522,"last_synced_commit":"75b0877ba3618168cf9ae885878cd426db17d0d7"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SachinAgarwal1337%2Fgoogle-places-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SachinAgarwal1337%2Fgoogle-places-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SachinAgarwal1337%2Fgoogle-places-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SachinAgarwal1337%2Fgoogle-places-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SachinAgarwal1337","download_url":"https://codeload.github.com/SachinAgarwal1337/google-places-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249206,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["google","google-api","google-places","google-places-api","laravel","laravel-google-places","laravel-google-places-api","places"],"created_at":"2024-12-25T00:12:52.217Z","updated_at":"2026-04-02T13:58:47.078Z","avatar_url":"https://github.com/SachinAgarwal1337.png","language":"PHP","funding_links":["https://github.com/sponsors/SachinAgarwal1337","https://buymeacoffee.com/sachin1337"],"categories":[],"sub_categories":[],"readme":"\n[![Latest Stable Version](https://poser.pugx.org/skagarwal/google-places-api/v/stable?format=flat-square)](https://packagist.org/packages/skagarwal/google-places-api)\n[![Latest Unstable Version](https://poser.pugx.org/skagarwal/google-places-api/v/unstable?format=flat-square)](https://packagist.org/packages/skagarwal/google-places-api)\n[![Total Downloads](https://poser.pugx.org/skagarwal/google-places-api/downloads?format=flat-square)](https://packagist.org/packages/skagarwal/google-places-api)\n[![License](https://poser.pugx.org/skagarwal/google-places-api/license?format=flat-square)](https://packagist.org/packages/skagarwal/google-places-api)\n\n\n# Google Places API.\n\nThis is a PHP wrapper for **Google Places API Web Service**. And is [Laravel Framework](https://laravel.com/docs/5.2) friendly.\n\n## About Package\nWith just 2 lines of code you can request to any google places api feature. No need to manually perform any curl requests.\n\n### The following place requests are available:\n* [Place Search](#place-search) This service gives a list of places based on a user's location or search string.\n* [Place Details](#place-details) This service gives more detailed information about a specific Place, including user reviews.\n* [Place Autocomplete](#place-autocomplete) This service is Used to automatically fill in the name and/or address of a place as you type.\n* [Query Autocomplete](#query-autocomplete) This service is Used to provide a query prediction service for text-based geographic searches, by returning suggested queries as you type.\n* [Place Photo](#place-photo) This gives you access to the millions of photos stored in the Google's Places database\n* [Custom Headers](#custom-headers) Set Custom Headers.\n* [Additional Methods](#additional-methods) Additional Methods Available.\n\n# Installation\nInstall it with composer\n```\ncomposer require skagarwal/google-places-api\n```\n\n\n\n# Usage\n\n**Laravel user can see the [Laravel Usage](#laravel-usage) section**\n\n## Step 1 - Import the class using namespace\n```php\nuse SKAgarwal\\GoogleApi\\PlacesApi;\n```\n\n## Step 2 - Initiate the object\n```php\n$googlePlaces = new PlacesApi('API KEY');\n```\n\n**Note:** You can also set the **API KEY** after initiating the class using `setKey('KEY')` method. You can chain this with method with any other methods.\n\n## Step 3 - Start Using the Api.\nExample:\n```php\n$response = $googlePlaces-\u003eplaceAutocomplete('some Place');\n```\n\nAs mentioned earlier just 2 lines of code to make any request.\n\n**Full example:**\n```php\nuse SKAgarwal\\GoogleApi\\PlacesApi;\n\n\nfunction () {\n  $googlePlaces = new PlacesApi('API_KEY') # line 1\n  $response = $googlePlaces-\u003eplaceAutocomplete('some input'); # line 2\n}\n\n```\n\n---\n\n\u003ca name=laravel-usage\u003e\u003c/a\u003e\n# Use with Laravel\n## For Laravel 5.5\nAuto Discovery added.\n\n## For Laravel 5.4 and below\n## Step 1\nSet up the service provider and facade in the **config\\app.php**\n```php\n\n'providers' =\u003e [\n....\n....\nSKAgarwal\\GoogleApi\\ServiceProvider::class,\n];\n\n'aliases' =\u003e [\n....\n....\n'GooglePlaces' =\u003e SKAgarwal\\GoogleApi\\Facade::class,\n];\n\n```\n\n## Step 2\npublish the config file with following artisan command\n```\nphp artisan vendor:publish --provider=\"SKAgarwal\\GoogleApi\\ServiceProvider\"\n```\n\nThis will create **google.php** file in the config directory.\n\nSet the *API KEY* in this config file.\n\n## Set 3\nStart using the package using Facade.\n\n```\n$response = GooglePlaces::placeAutocomplete('some city');\n```\n\n---\n# Response\nThe response returned is a [Laravel's Collection](https://laravel.com/docs/5.2/collections) so that you can perform any of the available collection methods on it.\n\n\u003cblockquote\u003e\nIf you are not familiar with \u003cem\u003eLaravel's Collection\u003c/em\u003e you can either reference the docs \u003ca href=\"https://laravel.com/docs/5.2/collections\"\u003ehere\u003c/a\u003e or you can use \u003cstrong\u003eresponse\u003c/strong\u003e as simple array.\n\u003c/blockquote\u003e\n\n---\n\n# Available Methods\n\n\u003ca name=place-search\u003e\u003c/a\u003e\n## Place Search\n### nearbySearch($location, $radius = null, $params = [])\n* `location` — The latitude/longitude around which to retrieve place information. This must be specified as latitude, longitude.\n* 'radius' — Defines the distance (in meters) within which to return place results. The maximum allowed radius is 50 000 meters. Note that `radius` must not be included if `rankby=distance` (described under **Optional parameters** below) is specified.\n* If `rankby=distance` (described under **Optional parameters** below) is specified, then one or more of `keyword`, `name`, or `types` is required.\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/search)\n\n### textSearch($query, $params = [])\n* `query` — The text string on which to search, for example: \"restaurant\". The Google Places service will return candidate matches based on this string and order the results based on their perceived relevance.\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/search)\n\n### findPlace($input, $inputType, $params = []) \n* `input` — The text input specifying which place to search for (for example, a name, address, or phone number).\n* `inputType` — The type of input. This can be one of either textquery or phonenumber. Phone numbers must be in international format (prefixed by a plus sign (\"+\"), followed by the country code, then the phone number itself).\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/search#FindPlaceRequests)\n\n---\n\n\u003ca name=place-details\u003e\u003c/a\u003e\n# Place Details\n### placeDetails($placeId, $params = [])\n* `placeId` — A textual identifier that uniquely identifies a place, returned from a Place Search.\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/details)\n\n---\n\n\u003ca name=place-autocomplete\u003e\u003c/a\u003e\n# Place Autocomplete\n### placeAutocomplete($input, $params = [])\n* `input` — The text string on which to search. The Place Autocomplete service will return candidate matches based on this string and order results based on their perceived relevance.\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/autocomplete)\n\n---\n\n\u003ca name=query-autocomplete\u003e\u003c/a\u003e\n# Query Autocomplete\n### queryAutocomplete($input, $params = [])\n* `input` — The text string on which to search. The Places service will return candidate matches based on this string and order results based on their perceived relevance.\n* `params` - **Optional Parameters** You can refer all the available optional parameters on the [Google's Official Webpage](https://developers.google.com/places/web-service/query)\n\n---\n\n\u003ca name=place-photo\u003e\u003c/a\u003e\n# Place Photo\n### photo($photoReference, $params = [])\n* `params` - The set of key-value parameters necessary to add a place to Google. You can refer to the fields on [Google's Official Webpage regarding Place Add](https://developers.google.com/places/web-service/photos)\n\n---\n\n\u003ca name=custom-headers\u003e\u003c/a\u003e\n# Custom Headers\n### withHeaders(array $headers)\nCall This method before any other methods to set the headers. You can chain this method.\n\n### new PlacesApi($key = null, $verifySSL = true, array $headers = [])\nTo have custom headers set for every call, you can pass 3rd parameter as the headers to class constructor.\n\n**Note:** For Laravel Users, you can set this in config file with key `headers`\n\n---\n\n\u003ca name=additional-methods\u003e\u003c/a\u003e\n# Additional Methods\n### getStatus()\nThis will return the status of the response send by google api. Use it after making any request.\n\n### getKey()\nThis will return the `API KEY` been used with the requests.\n\n### setKey($key)\nThis will set the `API KEY`.\n\n### verifySSL($verifySSL = true)\nYou can pass `false` to disable Verification of SSL Certification.\n\n**Note:** For Laravel Users, you can set this in config file with key `verify_ssl` \n\nOr You can Pass the path to the certificate.\n\n\u003ca name=exceptions\u003e\u003c/a\u003e\n# Exceptions\nGoogle Places API may throw various exceptions based on the given `$params` or response and is located in the `SKAgarwal\\GoogleApi\\Exceptions` namespace.\n\n- A `GooglePlacesApiException` is thrown when no `API KEY` is provided or  `$params` is invalid. \n**Note:** This is the parent class for the preceding exceptions.\n- A `InvalidRequestException` is thrown when the response `status` is `INVALID_REQUEST`\n- A `OverQueryLimitException` is thrown when  the response `status` is `OVER_QUERY_LIMIT`\n- A `RequestDeniedException` is thrown when  the response `status` is `REQUEST_DENIED`\n- A `UnknownErrorException` is thrown when  the response `status` is `UNKNOWN_ERROR`\n- A `NotImplementedException` is thrown when the response cannot be determined.\n\nIf any of these exception has been thrown, you can use the `getErrorMessage()` method to get the `error_message` field from the response if any is provided. \n**Note:** `error_message` field is not guaranteed to be always present, and its content is subject to change.\n\n# Contribution\nFeel free to report issues or make Pull Requests.\nIf you find this document can be improved in any way, please feel free to open an issue for it.\n\n# License\n\nThe Google Places Api is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachinagarwal1337%2Fgoogle-places-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsachinagarwal1337%2Fgoogle-places-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsachinagarwal1337%2Fgoogle-places-api/lists"}