PHPackages                             gitwa2/hero-open-weather-php - 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. gitwa2/hero-open-weather-php

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

gitwa2/hero-open-weather-php
============================

A simple PHP package to fetch weather data using latitude and longitude.

01PHP

Since Aug 4Pushed 1y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Hero Open Weather PHP
=====================

[](#hero-open-weather-php)

A simple PHP package to fetch weather data using latitude and longitude.

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

[](#installation)

You can install this package via Composer:

```
composer require gitwa2/hero-open-weather-php:dev-main
```

Usage
-----

[](#usage)

### Importing the Package

[](#importing-the-package)

To use the `hero-open-weather-php` package in your project, you need to include the Composer autoloader.

```
require 'vendor/autoload.php';

use HeroOpenWeather\WeatherClient;
```

### Fetching Weather Data

[](#fetching-weather-data)

You can fetch the weather data by providing the latitude and longitude.

```
require 'vendor/autoload.php';

use HeroOpenWeather\WeatherClient;

$latitude = 35.6895; // Example: Latitude for Tokyo
$longitude = 139.6917; // Example: Longitude for Tokyo

$weatherClient = new WeatherClient();

try {
    $weatherData = $weatherClient->getWeather($latitude, $longitude);
    echo "Weather Data:\n";
    foreach ($weatherData['hourly']['time'] as $index => $time) {
        echo "Time: $time, Temperature: {$weatherData['hourly']['temperature_2m'][$index]}°C\n";
    }
} catch (Exception $e) {
    echo $e->getMessage();
}
```

### Example Response

[](#example-response)

Here's an example of the response data you might receive:

```
{
    "latitude": 35.6895,
    "longitude": 139.6917,
    "generationtime_ms": 1.5,
    "utc_offset_seconds": 0,
    "timezone": "UTC",
    "hourly_units": {
        "time": "iso8601",
        "temperature_2m": "°C"
    },
    "hourly": {
        "time": [
            "2024-08-04T00:00:00Z",
            "2024-08-04T01:00:00Z",
            "2024-08-04T02:00:00Z"
            // more timestamps
        ],
        "temperature_2m": [
            25.3,
            24.8,
            24.1
            // more temperatures
        ]
    }
}
```

Author
------

[](#author)

Milad Davoodabadi ()

License
-------

[](#license)

This project is licensed under the ISC License.

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

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.

### Community

Maintainers

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

### Embed Badge

![Health badge](/badges/gitwa2-hero-open-weather-php/health.svg)

```
[![Health](https://phpackages.com/badges/gitwa2-hero-open-weather-php/health.svg)](https://phpackages.com/packages/gitwa2-hero-open-weather-php)
```

###  Alternatives

[dmind/cookieman

Provides a user consent popup. It asks for approval to include tracking objects (cookies, images or any HTML) and includes the objects when consented. It also removes cookies after the consent has been revoked.

39190.5k](/packages/dmind-cookieman)

PHPackages © 2026

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