PHP code example of onecodemonkey / amap_sdk
1. Go to this page and download the library: Download onecodemonkey/amap_sdk 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/ */
onecodemonkey / amap_sdk example snippets
use Amap\Amap;
use Hyperf\Guzzle\ClientFactory;
use Hyperf\Di\Annotation\Inject;
class Test {
/**
* @Inject
* @var ClientFactory
*/
private $clientFactory;
/**
* 搜索周边 POI
*/
public function testSearchAround()
{
$options = [
'key' => 'XXX',
];
$client = new Amap($options, $this->clientFactory);
$params = [
'types' => 150500, // 地铁站
"offset" => 25,
"page" => 1,
];
$result = $client->aroundSearch("116.740000,40.330000", $params);
var_dump($result);
}
}