PHP code example of xabou / google-geocoding

1. Go to this page and download the library: Download xabou/google-geocoding library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xabou / google-geocoding example snippets


app('Geocoder')

app('Geocoder')->address('stadiou 14')
               ->language('el')
               ->region('gr')
               ->geocode()

app('Geocoder')->parameters([
                  'address'  => 'stadiou 14'
                  'language' => 'el'
                  'region'   => 'gr'
                ])
               ->geocode()

return [

    /*
   |--------------------------------------------------------------------------
   | Application Key
   |--------------------------------------------------------------------------
   |
   | Your application's API key. Make sure to get a Key before starting using
   | Google Geocoding API.
   |
   */

    'api_key' => '',

    /*
    |--------------------------------------------------------------------------
    | Google Maps Geocoding API URL
    |--------------------------------------------------------------------------
    |
    | Here you san set the URL for the Google Maps Geocoding API. By default,
    | HTTPS protocol has been selected.
    |
    */

    'request_url' => 'https://maps.googleapis.com/maps/api/geocode/',

    /*
    |--------------------------------------------------------------------------
    | Response Output Format
    |--------------------------------------------------------------------------
    |
    | Here you can configure the preferred output format of a Geocoding
    | Request.
    |
    | Supported: "json", "xml"
    |
    */

    'output_format' => 'json',
];

php artisan vendor:publish --tag=geocoding-config