PHPackages                             imphinite/gaode-maps - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. imphinite/gaode-maps

ActiveLaravel[API Development](/categories/api)

imphinite/gaode-maps
====================

This is a php package for Gaode Web Services API

0.0.0(8y ago)145MITPHP

Since Dec 18Pushed 8y agoCompare

[ Source](https://github.com/imphinite/gaode-maps)[ Packagist](https://packagist.org/packages/imphinite/gaode-maps)[ RSS](/packages/imphinite-gaode-maps/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Collection of Gaode Web Services API for Laravel 5
--------------------------------------------------

[](#collection-of-gaode-web-services-api-for-laravel-5)

**DEVELOPMENT IN PROGRESS**

Provides convenient way of setting up and making requests to Gaode Web Services API from [Laravel](http://laravel.com/) application.

For services documentation, API key and Usage Limits visit [Gaode Web Services API](https://lbs.amap.com/api/webservice/summary/) and [Gaode Web Services API Usage Limits And Restrictions](https://lbs.amap.com/api/webservice/guide/tools/flowlevel/).

\*\*Note that this package is under development. Most Features are not implemented yet. Feel free to collaborate on this project!

\*\*SPECIAL THANKS TO [Alexpechkarev](https://github.com/alexpechkarev/). Web Services Engine is borrowed from [Alexpechkarev/google-maps](https://github.com/alexpechkarev/google-maps/).

Features
--------

[](#features)

- [Place Search API](https://lbs.amap.com/api/webservice/guide/api/search/)
- [Batch Request API](https://lbs.amap.com/api/webservice/guide/api/batchrequest/)

Features TO-DO List
-------------------

[](#features-to-do-list)

- [Geocoding/Reverse Geocoding API](https://lbs.amap.com/api/webservice/guide/api/georegeo/)
- [Directions API](https://lbs.amap.com/api/webservice/guide/api/direction/)
- [District Query API](https://lbs.amap.com/api/webservice/guide/api/district/)
- [Geolocation API](https://lbs.amap.com/api/webservice/guide/api/ipconfig/)
- [Roads API](https://lbs.amap.com/api/webservice/guide/api/autograsp/)
- [Static Maps API](https://lbs.amap.com/api/webservice/guide/api/staticmaps/)
- [Coordinate Convert API](https://lbs.amap.com/api/webservice/guide/api/convert/)
- [Weather API](https://lbs.amap.com/api/webservice/guide/api/weatherinfo/)
- [Auto Complete API](https://lbs.amap.com/api/webservice/guide/api/inputtips/)
- [Traffic API](https://lbs.amap.com/api/webservice/guide/api/trafficstatus/)
- [Geofence API](https://lbs.amap.com/api/webservice/guide/api/geofence_service/)

Dependency
----------

[](#dependency)

- [PHP cURL](http://php.net/manual/en/curl.installation.php)
- [PHP 5](http://php.net/)

Installation
------------

[](#installation)

Issue following command in console:

```
composer require imphinite/gaode-maps
```

Alternatively edit composer.json by adding following line and run **`composer update`**

```
"require": {
		....,
		"imphinite/gaode-maps",

	},
```

Configuration
-------------

[](#configuration)

Register package service provider and facade in 'config/app.php'

```
'providers' => [
    ...
    'GaodeMaps\ServiceProvider\GaodeMapsServiceProvider',
]

'aliases' => [
    ...
    'GaodeMaps' => 'GaodeMaps\Facade\GaodeMapsFacade',
]
```

Publish configuration file using **`php artisan vendor:publish --tag=gaodemaps --force`** or simply copy package configuration file and paste into **`config/gaodemaps.php`**

Open configuration file **`config/gaodemaps.php`** and add your service key

```
    /*
    |----------------------------------
    | Service Keys
    |------------------------------------
    */

    'key'       => 'YOUR GAODE API KEY HERE',
```

If you like to use different keys for any of the services, you can overwrite master API Key by specifying it in the `service` array for selected web service.

Usage
-----

[](#usage)

Here is an example of making request to Places Search API:

```
$service = GaodeMaps::load('nearbysearch')
        ->setParam([
            'location'          => '120.392164,36.056936',  // Longitude first in Chinese convention
            'keywords'          => '餐厅',
            'radius'            => 5000,
            'page'              => 1,
            'extensions'        => 'all',
            'output'            => 'json'
        ]);
$response = $service->get();
...
```

Alternatively parameters can be set using `setParamByKey()` method. For deeply nested array use "dot" notation as per example below.

```
$endpoint = GaodeMaps::load('nearbysearch')
        ->setParamByKey('location', '120.392164,36.056936')
        ->setParamByKey('keywords', '餐厅') //return $this
...
```

Another example showing request to Batch Request service when requesting multiple places' details:

```
$batch_urls = array();
array_push($batch_urls, (object) array(
    'url' => GaodeMaps::load('placedetails')
        ->setParam(['id' => $place->id)
        ->getBatchUrl()
    )
);

$service = GaodeMaps::load('batchrequest')
        ->setParam([
            'ops'               => $batch_urls
        ]);
$response = $batch_service->get();
...
```

Available methods
-----------------

[](#available-methods)

- [`load( $serviceName )`](#load)
- [`setParamByKey( $key, $value )`](#setParamByKey)
- [`setParam( $parameters )`](#setParam)
- [`getBatchUrl()`](#getBatchUrl)
- [`get()`](#get)

---

**`load( $serviceName )`** - load web service by name

Accepts string as parameter, web service name as specified in configuration file.
Returns reference to it's self.

```
GaodeMaps::load('nearbysearch')
...
```

---

**`setParamByKey( $key, $value )`** - set request parameter using key:value pair

Accepts two parameters:

- `key` - body parameter name
- `value` - body parameter value

Deeply nested array can use 'dot' notation to assign value.
Returns reference to it's self.

```
$service = GaodeMaps::load('nearbysearch')
        ->setParamByKey('location', '120.392164,36.056936')
        ->setParamByKey('keywords', '餐厅') //return $this
...
```

---

**`setParam( $parameters )`** - set all request parameters at once

Accepts array of parameters
Returns reference to it's self.

```
$service = GaodeMaps::load('nearbysearch')
        ->setParam([
            'location'          => '120.392164,36.056936',  // Longitude first in Chinese convension
            'keywords'          => '餐厅',
            'radius'            => 5000,
            'page'              => 1,
            'extensions'        => 'all',
            'output'            => 'json'
        ]); // return $this
...
```

---

**`getBatchUrl()`** - generate a Url of this service for Batch Request web service

Returns Batch Request url of this service.

```
$url = GaodeMaps::load('nearbysearch')
    ->setParam([
        'location'          => '120.392164,36.056936',  // Longitude first in Chinese convension
        'keywords'          => '餐厅',
        'radius'            => 5000,
        'page'              => 1,
        'extensions'        => 'all',
        'output'            => 'json'
    ])->getBatchUrl();
...
```

---

- **`get()`** - perform web service request (irrespectively to request type POST or GET )

Returns web service response in the format specified by **`setEndpoint()`** method, if omitted defaulted to `JSON`. Use `json_decode()` to convert JSON string into PHP variable. See [Processing Response](https://developers.gaode.com/maps/documentation/webservices/#Parsing) for more details on parsing returning output.

```
$response = GaodeMaps::load('nearbysearch')
        ->setParam([
            'location'          => '120.392164,36.056936',  // Longitude first in Chinese convension
            'keywords'          => '餐厅',
            'radius'            => 5000,
            'page'              => 1,
            'extensions'        => 'all',
            'output'            => 'json'
        ])->get();

var_dump(json_decode($response));  // output
...

/*
{
    "status": "1",
    "count": "274",
    "info": "OK",
    "infocode": "10000",
    "suggestion": {
        "keywords": [],
        "cities": []
    },
    "pois": [
        "0": {
            "id": "B0FFFF4RX1",
            "tag": "牛道红花牛三品,菌类拼盘,新快猪上五花,牛舌厚切,石锅拌饭,红花三拼,红花牛芝士盖饭,烤蘑菇,红花牛肉,猪雪花肩胛肉,牛舌薄切,生拌牛肉,迷你现压朝鲜冷面,炒乌冬面,牛肩胛肉,酱香牛腿芯,海鲜饼,牛肋脊,泡菜饼,烤牛肉,牛仔骨,海鲜乌冬面,红花牛特色三样,烤五花肉,极品一口牛排",
            "name": "新快牛道红花牛馆(百丽广场店)",
            "type": "餐饮服务;中餐厅;特色/地方风味餐厅",
...
*/
```

MIT License
-----------

[](#mit-license)

Collection of Gaode Web Services API for Laravel 5 is released under the [MIT License](https://github.com/imphinite/gaode-maps/blob/master/LICENSE).

###  Health Score

25

—

LowBetter than 36% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3115d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/32465309?v=4)[Charles Wang](/maintainers/imphinite)[@imphinite](https://github.com/imphinite)

---

Top Contributors

[![imphinite](https://avatars.githubusercontent.com/u/32465309?v=4)](https://github.com/imphinite "imphinite (17 commits)")

---

Tags

apiplaces api web serviceGaode maps apiGaode web services apiChina places apilaravel places api

### Embed Badge

![Health badge](/badges/imphinite-gaode-maps/health.svg)

```
[![Health](https://phpackages.com/badges/imphinite-gaode-maps/health.svg)](https://phpackages.com/packages/imphinite-gaode-maps)
```

###  Alternatives

[saloonphp/laravel-plugin

The official Laravel plugin for Saloon

806.6M187](/packages/saloonphp-laravel-plugin)[resend/resend-laravel

Resend for Laravel

1212.2M8](/packages/resend-resend-laravel)[essa/api-tool-kit

set of tools to build an api with laravel

53386.5k](/packages/essa-api-tool-kit)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
