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 5d 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 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

2085d 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

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[dhlparcel/magento2-plugin

DHL Parcel plugin for Magento 2

11180.5k2](/packages/dhlparcel-magento2-plugin)[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)
