PHP code example of latrell / geohash

1. Go to this page and download the library: Download latrell/geohash 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/ */

    

latrell / geohash example snippets


    'providers' => [
        // ...
        'Latrell\Geohash\GeohashServiceProvider',
    ]

    'aliases' => [
        // ...
        'Geohash' => 'Latrell\Geohash\Facades\Geohash',
    ]

echo Geohash::encode(31.283131, 121.500831); // wtw3uyfjqw61

list($lat, $lng) = Geohash::decode('wtw3uyfjqw61');
echo $lat, ', ', $lng; // 31.283131, 121.500831