PHPackages                             sunsgne/weather - 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. sunsgne/weather

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

sunsgne/weather
===============

weather

0.1.2(3y ago)021MITPHPPHP &gt;=7.2

Since May 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/sunsgneayo/weather)[ Packagist](https://packagist.org/packages/sunsgne/weather)[ RSS](/packages/sunsgne-weather/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (13)Used By (0)

[![sunsgne](https://camo.githubusercontent.com/e366b0a276ef18e50c689cb143c8f78eadfa2e14e8af4a8e9e1628362ad93f1e/68747470733a2f2f63646e2e6e696e65313132302e636e2f6c6f676f2d692e706e67)](https://camo.githubusercontent.com/e366b0a276ef18e50c689cb143c8f78eadfa2e14e8af4a8e9e1628362ad93f1e/68747470733a2f2f63646e2e6e696e65313132302e636e2f6c6f676f2d692e706e67)

高德地图 weather
============

[](#高德地图-weather)

🌈 基于IP获取[高德开放平台](https://lbs.amap.com/dev/id/newuser)的天气信息插件

安装
--

[](#安装)

```
composer require sunsgne/weather
```

使用
--

[](#使用)

### 配置

[](#配置)

[高德开放平台](https://lbs.amap.com/dev/id/newuser) 注册账号，然后创建应用，获取应用的 API Key。

### 地理位置

[](#地理位置)

```
$clientIp = $request->getRealIp();
sunsgne\Weather::getClientCityByIp($clientIp);
```

#### 响应

[](#响应)

```
array(7) {
  ["status"]=>
  string(1) "1"
  ["info"]=>
  string(2) "OK"
  ["infocode"]=>
  string(5) "10000"
  ["province"]=>
  string(9) "重庆市"
  ["city"]=>
  string(9) "重庆市"
  ["adcode"]=>
  string(6) "500000"
  ["rectangle"]=>
  string(46) "106.2832832,29.36962828;106.8138242,29.7401968"
}
```

### 实时天气

[](#实时天气)

```
$clientIp = $request->getRealIp();
sunsgne\Weather::liveWeather($clientIp);
```

### 预报天气

[](#预报天气)

```
$clientIp = $request->getRealIp();
sunsgne\Weather::forecastsWeather($clientIp);
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Every ~0 days

Total

12

Last Release

1455d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65843af70bae47cda80e0386c0640e2e17e1f8c8a12ea8fade3e1297237b26f3?d=identicon)[sunsgneayo](/maintainers/sunsgneayo)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sunsgne-weather/health.svg)

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

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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