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

ActiveLibrary

ctlynl/weather
==============

高德API获取天气接口

v2.0(2y ago)513MITPHPPHP &gt;=7.4

Since Jun 20Pushed 2y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (4)Used By (0)

 weather
=========

[](#-weather-)

 基于 高德开放平台 的 PHP 天气信息组件。

[![Tests](https://github.com/Ctlynl/weather/actions/workflows/tests.yml/badge.svg)](https://github.com/Ctlynl/weather/actions/workflows/tests.yml)

安装
--

[](#安装)

```
$ composer require ctlynl/weather:v2.0 -vvv
```

配置
--

[](#配置)

###### 在使用本扩展之前，你需要去 高德开放平台 注册账号，然后创建应用，获取应用的 API Key

[](#在使用本扩展之前你需要去-高德开放平台-注册账号然后创建应用获取应用的-api-key)

使用
--

[](#使用)

```
use Overtrue\Weather\Weather;

$key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';

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

### 参数说明

[](#参数说明)

```
1、$city - 城市名，比如：“深圳”；
3、$format - 输出的数据格式，默认为 json 格式，当 output 设置为 “xml” 时，输出的为 XML 格式的数据。
```

#### 获取实时天气

[](#获取实时天气)

```
$response = $weather->getLiveWeather('深圳');
```

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

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

```
$response = $weather->getForecastsWeather('深圳');
```

#### 获取 XML 格式返回值（默认json）

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

```
$response = $weather->getLiveWeather('深圳', 'xml');
```

LICENSE MIT
-----------

[](#license-mit)

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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

1062d ago

Major Versions

v1.0 → v2.02023-06-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/af8be67fc1520d9b1f18a5b013acc77613d4b058b804f84908d450febdcf7012?d=identicon)[mahongcan](/maintainers/mahongcan)

---

Top Contributors

[![Ctlynl](https://avatars.githubusercontent.com/u/38125573?v=4)](https://github.com/Ctlynl "Ctlynl (5 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[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)

PHPackages © 2026

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