Download the PHP package alex-kalanis/google-maps-php-services without Composer
On this page you can find all versions of the php package alex-kalanis/google-maps-php-services. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alex-kalanis/google-maps-php-services
More information about alex-kalanis/google-maps-php-services
Files in alex-kalanis/google-maps-php-services
Package google-maps-php-services
Short Description PHP client library(SDK) for Google Maps API Web Services
License MIT
Homepage https://github.com/alex-kalanis/google-maps-php-services
Informations about the package google-maps-php-services
Google Maps Services for PHP
PHP client library(SDK) for Google Maps API Web Services.
Fork of older Nick Tsai's library.
Differences:
- Minimal php is 8.1
- Type checks
- Dependency injection
- With PSR and other remote libraries than Guzzle/Curl in mind
- Only API key now usable
OUTLINE
- Demonstration
- Description
- Requirements
- API keys
- Installation
- Usage
- Client
- Language
- Directions API
- Distance Matrix API
- Routes API
- Elevation API
- Geocoding API
- Geolocation API
- Time Zone API
- Nearby API
- Find by Place API
- Find by Text API
- Place details API
- Client
DEMONSTRATION
For nearly any raw php / custom frameworks:
Then on desired pages:
For Laravel:
And then in the controller is the code the same as in another random framework.
For Symfony:
For Nette:
Or with parameters for different servers/services:
And then in class like in other frameworks with DI.
DESCRIPTION
The PHP Client for Google Maps Services is a PHP Client library for the following Google Maps APIs:
- Maps
- Google Doc)
- Routes
- Google Doc)
- Google Doc)
- Google Doc)
- Google Doc)
- Places
- Google Doc)
- Google Doc)
- Google Doc)
- Google Doc)
- Google Doc)
- Google Doc)
- Google Doc)
REQUIREMENTS
- PHP 8.1+ or higher
API keys
Each Google Maps Web Service request requires an API key or client ID. API keys are freely available with a Google Account at https://developers.google.com/console. The type of API key you need is a Server key.
To get an API key:
- Visit https://developers.google.com/console and log in with a Google Account.
- Select one of your existing projects, or create a new project.
-
Enable the Google Maps Services API(s) you plan to use, such as:
- Directions API
- Distance Matrix API
- Geocoding API
- Places API
- Roads API
- Time Zone API
- Nearby API
- Create a new Server key.
- If you'd like to restrict requests to a specific IP address, do so now.
For guided help, follow the instructions for the Directions API. You only need one API key, but remember to enable all the APIs you need. For even more information, see the guide to API keys.
Important: This key should be kept secret on your server.
INSTALLATION
Run Composer in your project:
composer require alex-kalanis/google-maps-php-services
Then you could call it after Composer is loaded depended on your PHP framework:
USAGE
Before using any Google Maps Services, first you need to create a Client with configuration, then use the client to access Google Maps Services.
Client
Create a Client using API key:
Language
You could set language for Client for all services:
APIs
Elevation API
Elevation API overview | Google for Developers
Routes API
Get a route | Google for Developers
Roads API
Snap to Roads | Google for Developers
Directions API
Getting directions | Google for Developers
Distance Matrix API
Get started with the Distance Matrix API | Google for Developers
Geocoding API
Geocoding API overview | Google for Developers
Geolocation API
Geolocation API overview | Google for Developers
Time Zone API
Time Zone API overview | Google for Developers
Nearby API
Nearby API overview | Google for Developers
Find by Place API
Find by Place API overview | Google for Developers
Find by Text API
Find by Text API overview | Google for Developers