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

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

itan/weather
============

a weather SDK

01PHPCI failing

Since Sep 25Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

\##简介

基于 [高德开放平台](https://lbs.amap.com/api/webservice/guide/api/weatherinfo) 的 PHP 天气信息组件。

安装
--

[](#安装)

```
$ composer require itan/weather:dev-master
```

使用
--

[](#使用)

```
use Itan\Weather\Weather;

$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

$weather = new Weather($key);
```

\####获取实时天气

```
$response = $weather->getWeather('杭州');
```

\####示例

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

\####获取近期天气预报

```
$response = $weather->getWeather('杭州', 'all');
```

\####获取 XML 格式返回值 第三个参数为返回值类型，可选 json 与 xml，默认 json：

```
$response = $weather->getWeather('杭州', 'all', 'xml');
```

参考
--

[](#参考)

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

License
-------

[](#license)

MIT

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a1d356e32714780384e9c3569d53cb624452ad0917802b1c5079598edc90d88?d=identicon)[itan](/maintainers/itan)

### Embed Badge

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

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

###  Alternatives

[pedroborges/meta-tags

HTML meta tags generator for PHP.

4628.6k1](/packages/pedroborges-meta-tags)

PHPackages © 2026

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