Download the PHP package skagarwal/google-places-api without Composer

On this page you can find all versions of the php package skagarwal/google-places-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package google-places-api

Latest Stable Version Latest Unstable Version Total Downloads License

Google Places API.

This is a PHP wrapper for Google Places API Web Service. And is Laravel Framework friendly.

About Package

With just 2 lines of code you can request to any google places api feature. No need to manually perform any curl requests.

The following place requests are available:

Installation

Install it with composer

Usage

Laravel user can see the Laravel Usage section

Step 1 - Import the class using namespace

Step 2 - Initiate the object

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.

Step 3 - Start Using the Api.

Example:

As mentioned earlier just 2 lines of code to make any request.

Full example:


Use with Laravel

For Laravel 5.5

Auto Discovery added.

For Laravel 5.4 and below

Step 1

Set up the service provider and facade in the config\app.php

Step 2

publish the config file with following artisan command

This will create google.php file in the config directory.

Set the API KEY in this config file.

Set 3

Start using the package using Facade.


Response

The response returned is a Laravel's Collection so that you can perform any of the available collection methods on it.

If you are not familiar with Laravel's Collection you can either reference the docs here or you can use response as simple array.

Available Methods

Place Search

nearbySearch($location, $radius = null, $params = [])

textSearch($query, $params = [])

findPlace($input, $inputType, $params = [])


Place Details

placeDetails($placeId, $params = [])


Place Autocomplete

placeAutocomplete($input, $params = [])


Query Autocomplete

queryAutocomplete($input, $params = [])


Place Photo

photo($photoReference, $params = [])


Custom Headers

withHeaders(array $headers)

Call This method before any other methods to set the headers. You can chain this method.

new PlacesApi($key = null, $verifySSL = true, array $headers = [])

To have custom headers set for every call, you can pass 3rd parameter as the headers to class constructor.

Note: For Laravel Users, you can set this in config file with key headers


Additional Methods

getStatus()

This will return the status of the response send by google api. Use it after making any request.

getKey()

This will return the API KEY been used with the requests.

setKey($key)

This will set the API KEY.

verifySSL($verifySSL = true)

You can pass false to disable Verification of SSL Certification.

Note: For Laravel Users, you can set this in config file with key verify_ssl

Or You can Pass the path to the certificate.

Exceptions

Google Places API may throw various exceptions based on the given $params or response and is located in the SKAgarwal\GoogleApi\Exceptions namespace.

If 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. Note: error_message field is not guaranteed to be always present, and its content is subject to change.

Contribution

Feel free to report issues or make Pull Requests. If you find this document can be improved in any way, please feel free to open an issue for it.

License

The Google Places Api is open-sourced software licensed under the MIT license


All versions of google-places-api with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/container Version ^9.0|^10.0|^11.0
guzzlehttp/guzzle Version ^7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package skagarwal/google-places-api contains the following files

Loading the files please wait ....