PHP code example of mtsung / mapsapi

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

    

mtsung / mapsapi example snippets


use Mtsung\Mapsapi\TwddMap\Geocoding;

Mysql, Mongo        # 自行配置
MAPSAPI_GOOGLE_API_KEY=""     # 圖霸 KEY
MAPSAPI_MAP8_API_KEY=""   # Google API KEY
MAPSAPI_ENABLE_TWDD_MONGO=false

use Mtsung\Mapsapi\TwddMap\Directions;

/**
 * Directions
 *
 * @param $origin
 * @param $destination
 * @param $mode ['driving', 'walking', 'bicycling'], default='driving'
 * @return array|mixed
*/
$directions = Directions::directions('25.0097038,121.4401783', '25.0108898,121.4346963');

use Mtsung\Mapsapi\TwddMap\Geocoding;

$geocode = Geocoding::geocode('台北市內湖區瑞光路335號');

$reverseGeocode = Geocoding::reverseGeocode('25.0396476673,121.505226616');