PHPackages                             rubin/openweather - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. rubin/openweather

ActiveLibrary[HTTP &amp; Networking](/categories/http)

rubin/openweather
=================

OpenWeather API connector

1.2.2(1y ago)0199PHPPHP &gt;=8.1.0CI passing

Since Jul 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/xRubin/OpenWeather)[ Packagist](https://packagist.org/packages/rubin/openweather)[ RSS](/packages/rubin-openweather/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (4)Versions (7)Used By (0)

OpenWeather REST API
====================

[](#openweather-rest-api)

[![Build Status](https://github.com/xRubin/OpenWeather/workflows/CI/badge.svg)](https://github.com/xRubin/OpenWeather/actions)[![Latest Stable Version](https://camo.githubusercontent.com/6dc92ddfcf7097678764f3b20ad3eea5a33648b8a49f327d85588e796130b09b/687474703a2f2f706f7365722e707567782e6f72672f727562696e2f6f70656e776561746865722f76)](https://packagist.org/packages/rubin/openweather)[![Coverage Status](https://camo.githubusercontent.com/08842739a4ec9c08c33221e8624056fd21308c6deadeebbda842b02a1f710174/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f78527562696e2f4f70656e576561746865722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/xRubin/OpenWeather?branch=master)[![PHP Version Require](https://camo.githubusercontent.com/03b16e2cb67021ee542515f7e8c4606b4a5177c78e4b6103caa1daa6fa684764/687474703a2f2f706f7365722e707567782e6f72672f727562696e2f6f70656e776561746865722f726571756972652f706870)](https://packagist.org/packages/rubin/openweather)

PHP implementation for the [OpenWeather](https://openweathermap.org/) REST API. This library is based on the [REST API docs](https://openweathermap.org/current).

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

[](#installation)

With composer:

```
composer require rubin/openweather
```

Usage
-----

[](#usage)

Create API connector:

```
$openWeatherApi = new \OpenWeather\OpenWeatherApi('{key}');
```

Set language (optional):

```
$openWeatherApi->setLanguage('ru');
```

Examples
--------

[](#examples)

Example script to get current weather:

```
$openWeatherApi = new \OpenWeather\OpenWeatherApi('{key}');
$output = new \Symfony\Component\Console\Output\StreamOutput(fopen('php://stdout', 'w'));
$table = new \Symfony\Component\Console\Helper\Table($output);

$table
    ->setHeaders(['Latitude', 'Longitude', 'Temperature', 'Weather'])
    ->setRows(array_map(function (\OpenWeather\GeoCoordinates $coordinates) use ($openWeatherApi) {
        $current = $openWeatherApi->getCurrentWeather($coordinates);
        return [
            $coordinates->lat,
            $coordinates->lon,
            $current->main->temp,
            $current->weather[0]->description
        ];
    }, [
        new \OpenWeather\GeoCoordinates(lon: 37.36, lat: 55.45),
        new \OpenWeather\GeoCoordinates(lon: -66.159, lat: -68.2008),
        new \OpenWeather\GeoCoordinates(lon: 147.794, lat: -31.358)
    ]));

$table->render();
```

Example script to get 5 days forecast:

```
$openWeatherApi = new \OpenWeather\OpenWeatherApi('{key}');
$output = new \Symfony\Component\Console\Output\StreamOutput(fopen('php://stdout', 'w'));
$table = new \Symfony\Component\Console\Helper\Table($output);

$table
    ->setHeaders(['DateTime', 'Temperature', 'PoP', 'Weather'])
    ->setRows(array_map(fn(\OpenWeather\ForecastItem $item) => [
        $item->dt->format('Y-m-d H:i:s'),
        $item->main->temp,
        $item->pop,
        $item->weather[0]->description,
    ], $openWeatherApi->getForecast(new \OpenWeather\GeoCoordinates(lon: -66.159, lat: -68.2008))->list));

$table->render();
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance45

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

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

Every ~51 days

Recently: every ~64 days

Total

6

Last Release

424d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.2.0

1.2.0PHP &gt;=8.1.0

### Community

Maintainers

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

---

Top Contributors

[![xRubin](https://avatars.githubusercontent.com/u/9638619?v=4)](https://github.com/xRubin "xRubin (11 commits)")

---

Tags

restopenweather

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rubin-openweather/health.svg)

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

###  Alternatives

[shopify/shopify-api

Shopify API Library for PHP

4634.8M16](/packages/shopify-shopify-api)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.3M14](/packages/xeroapi-xero-php-oauth2)[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client

Documentation for all of Ory Hydra's APIs.

17435.9k](/packages/ory-hydra-client)

PHPackages © 2026

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