PHPackages                             rainsens/map - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. rainsens/map

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

rainsens/map
============

A map sdk

2.1.1(7y ago)134MITPHP

Since Dec 3Pushed 7y ago1 watchersCompare

[ Source](https://github.com/rainsens/map)[ Packagist](https://packagist.org/packages/rainsens/map)[ RSS](/packages/rainsens-map/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

 Map
=====

[](#-map-)

 A map sdk for getting Geo Code and Geo-Fencing.

Installing
----------

[](#installing)

```
$ composer require rainsens/map -vvv
```

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

[](#configuration)

You have to get the API Key from [Amap](https://lbs.amap.com) before use.

Usage
-----

[](#usage)

```
use Rainsens\Map\Map;
$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$map = new Map($key);
```

Getting one geocoding once
--------------------------

[](#getting-one-geocoding-once)

```
$map->GeoCode->get('北京市朝阳区阜通东大街6号', '北京');
$map->GeoCode->get('北京市朝阳区阜通东大街6号', '北京', 'json');
$map->GeoCode->get('北京市朝阳区阜通东大街6号', '北京', 'xml');
```

Getting multi geocoding once
----------------------------

[](#getting-multi-geocoding-once)

```
$cities = [
    '北京市朝阳区阜通东大街6号',
    '北京市通州区运河东大街6号',
];

$map->GeoCode->get($cities, '北京');
```

Example
-------

[](#example)

```
"status": "1",
"info": "OK",
"infocode": "10000",
"count": "1",
"geocodes": [
    {
        "formatted_address": "北京市朝阳区阜通东大街|6号",
        "country": "中国",
        "province": "北京市",
        "citycode": "010",
        "city": "北京市",
        "district": "朝阳区",
        "township": [],
        "neighborhood": {
            "name": [],
            "type": []
        },
        "building": {
            "name": [],
            "type": []
        },
        "adcode": "110105",
        "street": "阜通东大街",
        "number": "6号",
        "location": "116.483038,39.990633",
        "level": "门牌号"
    }
]
```

```

    1
    OK
    10000
    1

            北京市朝阳区阜通东大街|6号
            中国
            北京市
            010
            北京市
            朝阳区

            110105
            阜通东大街
            6号
            116.483038,39.990633
            门牌号

```

About Geo-Fencing
-----------------

[](#about-geo-fencing)

About arguments please refer [AMap](https://lbs.amap.com/api/webservice/guide/api/geofence_service).

```
$map->geoFence()->create([...]);
$map->geoFence()->search([...]);
$map->geoFence()->update([...]);
$map->geoFence()->enable(string $gid, bool $status = true);
$map->geoFence()->delete(string $gid);
$map->geoFence()->monitor([...]);
```

Using in Laravel
----------------

[](#using-in-laravel)

Install with the same way and put the API Key in `config/services.php`

```
    .
    .
    .
     'map' => [
        'key' => env('MAP_API_KEY'),
    ],
```

Then configure the MAP\_API\_KEY in .env

```
MAP_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

```
Map::geoCode->get('北京市朝阳区阜通东大街6号', '北京');
```

```
Map::geoFence()->create([...]);
Map::geoFence()->search([...]);
Map::geoFence()->update([...]);
Map::geoFence()->enable(string $gid, bool $status = true);
Map::geoFence()->delete(string $gid);
Map::geoFence()->monitor([...]);
```

About arguments above please refer [AMap](https://lbs.amap.com/api/webservice/guide/api/geofence_service).

Reference
---------

[](#reference)

[Amap](https://lbs.amap.com/api/webservice/guide/api/georegeo)

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/rainsens/map/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/rainsens/map/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity66

Established project with proven stability

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

Every ~3 days

Total

8

Last Release

2699d ago

Major Versions

0.0.1 → 1.0.02018-12-03

1.1.0 → 2.0.02018-12-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/85cc7663d5beaa236e4b4feca559ef19076c812b6fa4ea337bc181fe34034938?d=identicon)[Rainsen](/maintainers/Rainsen)

### Embed Badge

![Health badge](/badges/rainsens-map/health.svg)

```
[![Health](https://phpackages.com/badges/rainsens-map/health.svg)](https://phpackages.com/packages/rainsens-map)
```

###  Alternatives

[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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