PHPackages                             xiaobinqt/aweather - 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. xiaobinqt/aweather

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

xiaobinqt/aweather
==================

A weather SDK

2.0.0(6y ago)89MITPHP

Since Jun 29Pushed 6y agoCompare

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

READMEChangelog (4)Dependencies (3)Versions (6)Used By (0)

 weather
=========

[](#-weather-)

 A Weather SDK.

安装
--

[](#安装)

```
$ composer require xiaobinqt/aweather -vvv
```

使用
--

[](#使用)

```
use Xiaobinqt\Weather\Weather;

// 高德开放平台应用 API Key
$key = 'xxx';
$w = new Weather($key);
```

获取天气
----

[](#获取天气)

```
$response = $w->getWeather('深圳');
```

示例
--

[](#示例)

```
{
    "status": "1",
    "count": "1",
    "info": "OK",
    "infocode": "10000",
    "lives": [
        {
            "province": "广东",
            "city": "深圳市",
            "adcode": "440300",
            "weather": "阴",
            "temperature": "32",
            "winddirection": "西南",
            "windpower": "≤3",
            "humidity": "68",
            "reporttime": "2019-06-29 15:15:36"
        }
    ]
}

```

获取近期天气预报
--------

[](#获取近期天气预报)

```
{
    "status": "1",
    "count": "1",
    "info": "OK",
    "infocode": "10000",
    "forecasts": [
        {
            "city": "深圳市",
            "adcode": "440300",
            "province": "广东",
            "reporttime": "2019-06-29 15:15:36",
            "casts": [
                {
                    "date": "2019-06-29",
                    "week": "6",
                    "dayweather": "阵雨",
                    "nightweather": "多云",
                    "daytemp": "33",
                    "nighttemp": "28",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2019-06-30",
                    "week": "7",
                    "dayweather": "大雨",
                    "nightweather": "大雨",
                    "daytemp": "32",
                    "nighttemp": "28",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2019-07-01",
                    "week": "1",
                    "dayweather": "大雨",
                    "nightweather": "大雨",
                    "daytemp": "31",
                    "nighttemp": "27",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2019-07-02",
                    "week": "2",
                    "dayweather": "大雨-暴雨",
                    "nightweather": "大雨-暴雨",
                    "daytemp": "31",
                    "nighttemp": "26",
                    "daywind": "东南",
                    "nightwind": "东南",
                    "daypower": "4",
                    "nightpower": "4"
                }
            ]
        }
    ]
}

```

获取 XML 格式返回值
------------

[](#获取-xml-格式返回值)

#### 第三个参数为返回值类型,默认为 `json`,可选 `xml`和`json`

[](#第三个参数为返回值类型默认为-json可选-xml和json)

```

    1
    1
    OK
    10000

            广东
            深圳市
            440300
            阴
            32
            西南
            ≤3
            68
            2019-06-29 15:15:36

```

参考
--

[](#参考)

> [高德开放平台天气接口](https://lbs.amap.com/api/webservice/guide/api/weatherinfo/)

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

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/xiaobinqt/aweather/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/xiaobinqt/aweather/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

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~1 days

Total

5

Last Release

2510d ago

Major Versions

0.02 → 1.0.02019-06-29

1.0.0 → 2.0.02019-07-01

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23259661?v=4)[萧十一郎](/maintainers/xiaobinqt)[@xiaobinqt](https://github.com/xiaobinqt)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/xiaobinqt-aweather/health.svg)

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

###  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)
