PHPackages                             boringiii/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. [API Development](/categories/api)
4. /
5. boringiii/weather

ActiveLibrary[API Development](/categories/api)

boringiii/weather
=================

weather

0.0.2(5y ago)08MITPHPCI failing

Since Jul 5Pushed 5y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

 天气查询
======

[](#-天气查询-)

[![Build Status](https://camo.githubusercontent.com/0bcbb94ddfba5edecc01ecc647bb36058db353cfafdfd05a005d56b6f769bca5/68747470733a2f2f7472617669732d63692e6f72672f626f72696e676969692f776561746865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/boringiii/weather)

安装
--

[](#安装)

```
$ composer require boringiii/weather -vvv
```

使用
--

[](#使用)

PS: 需申请高德开发平台应用 API KEY（反正是免费的）

```
require __DIR__ .'/vendor/autoload.php';

use Boringiii\Weather\Weather;

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

echo "获取实时天气：\n";

$response = $w->getWeather('深圳');
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

echo "\n\n获取天气预报：\n";

$response = $w->getWeather('深圳', 'all');
echo json_encode($response, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);

echo "\n\n获取实时天气(XML)：\n";

echo $w->getWeather('深圳', 'base', 'XML');
```

正常响应
----

[](#正常响应)

```
获取实时天气：
{
    "status": "1",
    "count": "1",
    "info": "OK",
    "infocode": "10000",
    "lives": [
        {
            "province": "广东",
            "city": "深圳市",
            "adcode": "440300",
            "weather": "中雨",
            "temperature": "27",
            "winddirection": "南",
            "windpower": "6",
            "humidity": "94",
            "reporttime": "2018-08-21 16:00:00"
        }
    ]
}

获取天气预报：
{
    "status": "1",
    "count": "1",
    "info": "OK",
    "infocode": "10000",
    "forecasts": [
        {
            "city": "深圳市",
            "adcode": "440300",
            "province": "广东",
            "reporttime": "2018-08-21 11:00:00",
            "casts": [
                {
                    "date": "2018-08-21",
                    "week": "2",
                    "dayweather": "雷阵雨",
                    "nightweather": "雷阵雨",
                    "daytemp": "31",
                    "nighttemp": "26",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2018-08-22",
                    "week": "3",
                    "dayweather": "雷阵雨",
                    "nightweather": "雷阵雨",
                    "daytemp": "32",
                    "nighttemp": "27",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2018-08-23",
                    "week": "4",
                    "dayweather": "雷阵雨",
                    "nightweather": "雷阵雨",
                    "daytemp": "32",
                    "nighttemp": "26",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                },
                {
                    "date": "2018-08-24",
                    "week": "5",
                    "dayweather": "雷阵雨",
                    "nightweather": "雷阵雨",
                    "daytemp": "31",
                    "nighttemp": "26",
                    "daywind": "无风向",
                    "nightwind": "无风向",
                    "daypower": "≤3",
                    "nightpower": "≤3"
                }
            ]
        }
    ]
}

获取实时天气(XML)：

    1
    1
    OK
    10000

            广东
            深圳市
            440300
            中雨
            27
            南
            6
            94
            2018-08-21 16:00:00

⏎

```

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

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

2

Last Release

2140d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/40050948?v=4)[boringiii](/maintainers/boringiii)[@boringiii](https://github.com/boringiii)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

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

245.2k](/packages/aedart-athenaeum)[mapado/rest-client-sdk

Rest Client SDK for hydra API

1125.9k2](/packages/mapado-rest-client-sdk)

PHPackages © 2026

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