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

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

wangyw/weather
==============

这是一个测试的天气扩展包

0.0.3(5y ago)05MITPHPPHP ^7.0

Since Aug 30Pushed 5y ago1 watchersCompare

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

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

 weather
=========

[](#-weather-)

 基于高德地图的测试包.

[![Build status](https://camo.githubusercontent.com/7324ecde52cd905adc64a947a9b5540ca5716333e3c49052053825843c8c33f6/68747470733a2f2f7472617669732d63692e6f72672f673333627779772f776561746865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/github/g33bwyw/weather)[![StyleCI Build Status](https://camo.githubusercontent.com/d8b2ed79915042766c55d3ec77e88d8ac5f877e1bd625797399846a5c46e9506/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3238393834313337312f736869656c64)](https://camo.githubusercontent.com/d8b2ed79915042766c55d3ec77e88d8ac5f877e1bd625797399846a5c46e9506/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3238393834313337312f736869656c64)

安装
--

[](#安装)

B

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

使用
--

[](#使用)

```
use Wangyw\Weather\Weather;

$key = '*************';
$url = 'https://restapi.amap.com/v3/weather/weatherInfo';
$weather = new Weather('mock_key', $url);

```

获取实时天气
------

[](#获取实时天气)

```
$response = $weather->getWeather('深圳', 'base', 'json');

```

参数说明
----

[](#参数说明)

```
getWeather(string $cityName, string $type = 'base', string $format = 'json')

```

- $cityName -城市名
- $type -返回内容类型 base:实时天气 all:返回预报天气,默认为base
- $format -返回内容格式 默认为json ,可以指定为xml

在laravel中使用
-----------

[](#在laravel中使用)

- 在config文件中添加weather.php

```
return [
    'weather' => [
        'key' => '********',
        'url' => 'https://restapi.amap.com/v3/weather/weatherInfo',
    ],
];

```

- 方法参数注入

```
public function getBaseWeather(Weather $weather) {
    $response = $weather->getWeather('上海');
}

```

- 服务名域名访问

```
$response = app('weather')->getWeather('上海');

```

参考
--

[](#参考)

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

License
-------

[](#license)

MIT

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

3

Last Release

2132d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M46](/packages/tencentcloud-tencentcloud-sdk-php)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k40](/packages/civicrm-civicrm-core)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)[oat-sa/tao-core

TAO core extension

66143.7k120](/packages/oat-sa-tao-core)

PHPackages © 2026

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