1. Go to this page and download the library: Download pipiqiang/latlong 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/ */
pipiqiang / latlong example snippets
'extensions' => [
'latlong' => [
// Whether to enable this extension, defaults to true
'enable' => true,
// Specify the default provider
'default' => 'google',
// According to the selected provider above, fill in the corresponding api_key
'providers' => [
'google' => [
'api_key' => '',
],
'yadex' => [
'api_key' => '',
],
'baidu' => [
'api_key' => 'xck5**************************dx',
],
'tencent' => [
'api_key' => 'VV***-*****-*****-*****-*****-**BBT',
],
'amap' => [
'api_key' => '3693**************************fb',
],
'here' => [
'app_key' => 'ge*************************************WeD0'
],
]
]
]
$form->latlong('latitude', 'longitude', 'Position');
// Set the map height
$form->latlong('latitude', 'longitude', 'Position')->height(500);
// Set the map zoom
$form->latlong('latitude', 'longitude', 'Position')->zoom(16);
// Set default position
$form->latlong('latitude', 'longitude', 'Position')->default(['lat' => 90, 'lng' => 90]);