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

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

mathsgod/hko-weather
====================

Hong Kong Observatory weather forecast data fetcher

1.0.0(3mo ago)00MITPHPPHP &gt;=8.0CI passing

Since Mar 17Pushed 3mo agoCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

[![PHP Composer](https://github.com/mathsgod/hko-weather/workflows/PHP%20Composer/badge.svg)](https://github.com/mathsgod/hko-weather/workflows/PHP%20Composer/badge.svg)

hko-weather
===========

[](#hko-weather)

A PHP library for fetching Hong Kong weather forecast data from the [Hong Kong Observatory Open Data API](https://data.weather.gov.hk/weatherAPI/doc/HKO_Open_Data_API_Documentation.pdf).

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- Composer

Installation
------------

[](#installation)

```
composer require mathsgod/hko-weather
```

Usage
-----

[](#usage)

```
use HKO\Weather;

$w = new Weather();

// English (default)
$data = $w->fetch();

// Traditional Chinese
$data = $w->fetch('tc');

// Simplified Chinese
$data = $w->fetch('sc');

print_r($data);
```

### Return format

[](#return-format)

Each entry in the returned array contains:

KeyDescription`date`Date in `YYYY-MM-DD` format`low`Minimum temperature`high`Maximum temperature`unit`Temperature unit (e.g. `C`)`forecastWind`Wind description`forecastWeather`Weather description`forecastIcon`Weather icon code`forecastIconUrl`Weather icon image URL (PNG)Returns 9 days of forecast data.

### Example output

[](#example-output)

```
Array
(
    [0] => Array
        (
            [date] => 2026-03-18
            [low] => 21
            [high] => 26
            [unit] => C
            [forecastWind] => East force 2 to 3.
            [forecastWeather] => Mainly cloudy. One or two light rain patches at first. Warm with sunny periods during the day.
            [forecastIcon] => 51
            [forecastIconUrl] => https://www.hko.gov.hk/images/HKOWxIconOutline/pic51.png
        )

    [1] => Array
        (
            [date] => 2026-03-19
            [low] => 21
            [high] => 27
            [unit] => C
            [forecastWind] => Light winds force 2.
            [forecastWeather] => Sunny periods. Coastal fog in the morning. Rather warm during the day.
            [forecastIcon] => 83
            [forecastIconUrl] => https://www.hko.gov.hk/images/HKOWxIconOutline/pic83.png
        )

    ...
)

```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance81

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

99d ago

### Community

Maintainers

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

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

28410.1M49](/packages/yajra-laravel-datatables-html)[spatie/laravel-options

Create arrays of options from different sources

251327.7k2](/packages/spatie-laravel-options)[silverstripe/externallinks

Adds tracking of broken external links to the SilverStripe CMS

10232.1k4](/packages/silverstripe-externallinks)[eecli/bootstrap

Bootstrap the ExpressionEngine environment

349.9k1](/packages/eecli-bootstrap)

PHPackages © 2026

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