PHPackages                             voku/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. [API Development](/categories/api)
4. /
5. voku/weather

ActiveLibrary[API Development](/categories/api)

voku/weather
============

Weather API Wrapper

0.7.1(2y ago)81762[10 PRs](https://github.com/voku/weather/pulls)MITPHPPHP 8.1.\*||8.2.\*

Since Jul 14Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (22)Used By (0)

[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

[![Build Status](https://github.com/voku/weather/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/voku/weather/actions)[![codecov.io](https://camo.githubusercontent.com/07302f5e5db661833798331a76bcc5702ffa09fc241eaf6421c593f32f2b48bd/687474703a2f2f636f6465636f762e696f2f6769746875622f766f6b752f776561746865722f636f7665726167652e7376673f6272616e63683d6d61696e)](http://codecov.io/github/voku/weather?branch=main)

Weather Data Wrapper
====================

[](#weather-data-wrapper)

This is a simple wrapper around the "Bright Sky" () weather api.

- you can simply replace the weather api by implementing another weather provider class.

### DEMO: ()

[](#demo-httpsgithubcomvokuweather-demo)

### Install via "composer require"

[](#install-via-composer-require)

```
composer require voku/weather
composer require voku/httpful # or another php-http/client-implementation e.g. "php-http/react-adapter" + "nyholm/psr7"
```

### Usage:

[](#usage)

```
use voku\weather\provider\BrightskyHttpProvider;
use voku\weather\WeatherQueryDto;

require_once __DIR__ . '/vendor/autoload.php'; // example path

$latitude = 48.137154;
$longitude = 11.576124;
$dateTime = new \DateTimeImmutable('2023-01-01 12:00:00');

$weatherQuery = new WeatherQueryDto(
    $latitude,
    $longitude,
    $dateTime
);

$weather = (new BrightskyHttpProvider())->getWeatherHistorical($weatherQuery);

echo $weather->temperature; // 17.1
```

Example 1: (temperature with unit)

```
echo $weather->getTemperatureWithUnit(); // 17.1 °C
```

Example 2: (wind-speed with unit)

```
echo $weather->getWindSpeedWithUnit(); // 9 km/h
```

### Unit Test:

[](#unit-test)

1. [Composer](https://getcomposer.org) is a prerequisite for running the tests.

```
composer install

```

2. The tests can be executed by running this command from the root directory:

```
./vendor/bin/phpunit
```

AbstractHttpProvider methods
----------------------------

[](#abstracthttpprovider-methods)

[getSources](#getsources-weathersourcedto)[getWeatherCurrent](#getweathercurrentvokuweatherweatherquerydto-query)[getWeatherForecast](#getweatherforecastvokuweatherweatherquerydto-query)[getWeatherForecastCollection](#getweatherforecastcollectionvokuweatherweatherquerydto-query)[getWeatherHistorical](#getweatherhistoricalvokuweatherweatherquerydto-query)[getWeatherHistoricalCollection](#getweatherhistoricalcollectionvokuweatherweatherquerydto-query)getSources(): WeatherSourceDto\[\]
----------------------------------

[](#getsources-weathersourcedto)

[↑](#voku-php-readme-class-methods)

**Parameters:****nothing**

**Return:**

- `\WeatherSourceDto[]`

---

getWeatherCurrent(voku\\weather\\WeatherQueryDto $query):
---------------------------------------------------------

[](#getweathercurrentvokuweatherweatherquerydto-query)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `voku\weather\WeatherQueryDto $query`

**Return:**

- `voku\weather\WeatherDto`

---

getWeatherForecast(voku\\weather\\WeatherQueryDto $query):
----------------------------------------------------------

[](#getweatherforecastvokuweatherweatherquerydto-query)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `voku\weather\WeatherQueryDto $query`

**Return:**

- `voku\weather\WeatherDto`

---

getWeatherForecastCollection(voku\\weather\\WeatherQueryDto $query):
--------------------------------------------------------------------

[](#getweatherforecastcollectionvokuweatherweatherquerydto-query)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `voku\weather\WeatherQueryDto $query`

**Return:**

- `voku\weather\WeatherCollection`

---

getWeatherHistorical(voku\\weather\\WeatherQueryDto $query):
------------------------------------------------------------

[](#getweatherhistoricalvokuweatherweatherquerydto-query)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `voku\weather\WeatherQueryDto $query`

**Return:**

- `voku\weather\WeatherDto`

---

getWeatherHistoricalCollection(voku\\weather\\WeatherQueryDto $query):
----------------------------------------------------------------------

[](#getweatherhistoricalcollectionvokuweatherweatherquerydto-query)

[↑](#voku-php-readme-class-methods)

**Parameters:**

- `voku\weather\WeatherQueryDto $query`

**Return:**

- `voku\weather\WeatherCollection`

---

### Thanks

[](#thanks)

- Thanks to [GitHub](https://github.com) (Microsoft) for hosting the code and a good infrastructure including Issues-Management, etc.
- Thanks to [IntelliJ](https://www.jetbrains.com) as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
- Thanks to [StyleCI](https://styleci.io/) for the simple but powerful code style check.
- Thanks to [PHPStan](https://github.com/phpstan/phpstan) &amp;&amp; [Psalm](https://github.com/vimeo/psalm) for really great Static analysis tools and for discover bugs in the code!

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance58

Moderate activity, may be stable

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.8% 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 ~1 days

Total

9

Last Release

1030d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6456fe693db197c458272cb758bf78958bc7d3e787ccd59db4bf3cf41654316a?d=identicon)[voku](/maintainers/voku)

---

Top Contributors

[![voku](https://avatars.githubusercontent.com/u/264695?v=4)](https://github.com/voku "voku (36 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (5 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[deeplcom/deepl-php

Official DeepL API Client Library

2616.2M66](/packages/deeplcom-deepl-php)[m4tthumphrey/php-gitlab-api

GitLab API v4 client for PHP

9485.4M64](/packages/m4tthumphrey-php-gitlab-api)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

963.1M35](/packages/getbrevo-brevo-php)[swisnl/json-api-client

A PHP package for mapping remote JSON:API resources to Eloquent like models and collections.

211473.2k12](/packages/swisnl-json-api-client)

PHPackages © 2026

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