PHP code example of yoozi / lbs

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

    

yoozi / lbs example snippets




use Yoozi\LBS\Query\Place;
use Yoozi\LBS\Search;

$place = new Place;
$place->set('method', 'suggestion');
$place->set('q', '尚德大厦');
$place->set('region', '广州市');

$search = new Search('E4805d16520de693a3fe707cdc962045', $place);

var_dump($search->run()->toArray());

array(3) {
  ["status"]=>
  int(0)
  ["message"]=>
  string(2) "ok"
  ["result"]=>
  array(4) {
    [0]=>
    array(5) {
      ["name"]=>
      string(12) "尚德大厦"
      ["city"]=>
      string(9) "广州市"
      ["district"]=>
      string(9) "天河区"
      ["business"]=>
      string(0) ""
      ["cityid"]=>
      string(3) "257"
    }
    [1]=>
    array(5) {
      ["name"]=>
      string(16) "尚德大厦a座"
      ["city"]=>
      string(0) ""
      ["district"]=>
      string(0) ""
      ["business"]=>
      string(0) ""
      ["cityid"]=>
      string(1) "0"
    }
    [2]=>
    array(5) {
      ["name"]=>
      string(22) "尚德大厦-停车场"
      ["city"]=>
      string(9) "广州市"
      ["district"]=>
      string(9) "天河区"
      ["business"]=>
      string(0) ""
      ["cityid"]=>
      string(3) "257"
    }
    [3]=>
    array(5) {
      ["name"]=>
      string(18) "西安尚德大厦"
      ["city"]=>
      string(9) "西安市"
      ["district"]=>
      string(9) "新城区"
      ["business"]=>
      string(0) ""
      ["cityid"]=>
      string(3) "233"
    }
  }
}

    php composer install
    

    php composer update