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

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

luckywin/weather
================

A Weather SDK

0.0.1(7y ago)010MITPHP

Since Aug 27Pushed 7y agoCompare

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

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

 weather
=========

[](#-weather-)

🌈 基于高德高德开放平台的PHP天气查询接口.

[![Build Status](https://camo.githubusercontent.com/2f91a4496bf8009c260ba00c16cdff5c1f8a5af3677bf0430f7a92a388fec44b/68747470733a2f2f7472617669732d63692e6f72672f4c75636b796c6577696e2f576561746865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Luckylewin/Weather)[![StyleCI build status](https://camo.githubusercontent.com/a98b00498dbd81f434bb4b985811e26e1e84a4abbf83d1ecc091d377f2f24064/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134363235303239392f736869656c64)](https://camo.githubusercontent.com/a98b00498dbd81f434bb4b985811e26e1e84a4abbf83d1ecc091d377f2f24064/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3134363235303239392f736869656c64)

Installing
----------

[](#installing)

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

Usage
-----

[](#usage)

```
use Luckywin\Weather\Weather;

$key = 'xxxxxxxxxxxxxxxxxxxx';

$weather = new Weather($key);

```

Access to real-time weather
---------------------------

[](#access-to-real-time-weather)

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

```

##### example

[](#example)

```
{
    "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"
        }
    ]
}

```

For the recent weather forecast
-------------------------------

[](#for-the-recent-weather-forecast)

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

```

###### example

[](#example-1)

```
{
    "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"
                }
            ]
        }
    ]
}

```

The return value for XML format
-------------------------------

[](#the-return-value-for-xml-format)

The third parameter is the return value type, optional json and XML, json by default:

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

```

###### example

[](#example-2)

```

    1
    1
    OK
    10000

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

```

parameter declaration;
----------------------

[](#parameter-declaration)

```
array | string   getWeather(string $city, string $type = 'base', string $format = 'json')

```

- $city - city name,for example like '深圳'
- $type - response content type: base/all. base return real-time and all return all
- $format - the input format, json | xml

Contributing
------------

[](#contributing)

You can contribute in one of three ways:

1. File bug reports using the [issue tracker](https://github.com/luckywin/weather/issues).
2. Answer questions or fix bugs on the [issue tracker](https://github.com/luckywin/weather/issues).
3. Contribute new features or update the wiki.

*The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.*

License
-------

[](#license)

MIT

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2865d ago

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k36](/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.4k39](/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.7k116](/packages/oat-sa-tao-core)[ec-europa/toolkit

Toolkit packaged for Drupal projects based on Robo.

40252.8k34](/packages/ec-europa-toolkit)

PHPackages © 2026

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