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

ActiveLibrary[API Development](/categories/api)

solgenpower/laravel-openweather
===============================

A Laravel SDK for OpenWeather API

v0.4.0(1y ago)71.8k↓25%2[4 issues](https://github.com/solgenpower/laravel-openweather/issues)MITPHPPHP ^8.1

Since Mar 8Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (12)Used By (0)

Laravel OpenWeather
===================

[](#laravel-openweather)

A Laravel SDK for OpenWeather API

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

[](#installation)

Install the package via composer:

```
composer require solgenpower/laravel-openweather
```

If you're interested in modifying the config file, then publish it using the following command:

```
php artisan vendor:publish --provider="SolgenPower\LaravelOpenWeather\OpenWeatherServiceProvider"
```

This is the contents of the published config file:

```
return [

    /**
     * API Key for Open Weather
     */
    'api-key' => env('OPENWEATHER_API_KEY', ''),

    /**
     * Endpoint for the Current Weather
     */
    'current-endpoint' => env('OPENWEATHER_CURRENT_ENDPOINT', 'https://api.openweathermap.org/data/2.5/weather/'),

    /**
     * Endpoint for the Weather Condition icons
     * Reference: https://openweathermap.org/weather-conditions
     */
    'icon-endpoint' => env('OPENWEATHER_ICON_ENDPOINT', 'https://openweathermap.org/img/wn/'),

    /**
     * Map icon code to actual icon filenames
     */
    'icon-map' => [
        /**
         * Day Icons
         */
        '01d' => '01d.png',
        '02d' => '02d.png',
        '03d' => '03d.png',
        '04d' => '04d.png',
        '09d' => '09d.png',
        '10d' => '10d.png',
        '11d' => '11d.png',
        '13d' => '13d.png',
        '50d' => '50d.png',

        /**
         * Night Icons
         */
        '01n' => '01n.png',
        '02n' => '02n.png',
        '03n' => '03n.png',
        '04n' => '04n.png',
        '09n' => '09n.png',
        '10n' => '10n.png',
        '11n' => '11n.png',
        '13n' => '13n.png',
        '50n' => '50n.png',
    ],

    /**
     * Cache duration default in seconds, 60 * 10 is 10 minutes
     */
    'cache-duration' => 60 * 10,

    /**
     * standard => Kelvin
     * imperial => Fahrenheit
     * metric => Celsius
     */
    'temperature-unit' => env('OPENWEATHER_TEMPERATURE_UNIT', 'imperial'),

];
```

Usage
-----

[](#usage)

You can get weather information by providing coordinates

```
$whiteHouseWeather = OpenWeather::coordinates("38.897957", "-77.036560");
echo $whiteHouseWeather->humidity; //64
```

or by zip code

```
$californiaWeather = OpenWeather::zip('90210', 'US');
echo $californiaWeather->windDirection; //N
```

or by city name

```
$pheonixWeather = OpenWeather::city('Tucson', 'AZ', 'US');
echo $pheonixWeather->feelsLike; //281.55
```

All these methods will return a Weather DTO that looks like this:

```
class Weather
{
    public function __construct(
        public readonly float $latitude,

        public readonly float $longitude,

        public readonly ?string $countryCode,

        public readonly ?string $city,

        public readonly string $condition,

        public readonly string $description,

        public readonly string $icon,

        public readonly float $temperature,

        public readonly ?float $feelsLike,

        public readonly ?int $pressure,

        public readonly ?int $humidity,

        public readonly ?float $windSpeed,

        public readonly ?int $windAngle,

        public readonly ?string $windDirection,

        public readonly ?int $cloudiness,

        public readonly ?int $visibility,

        /**
         * Seconds difference from UTC
         * To use with Carbon's timezone method, divide by 3600
         */
        public readonly int $timezone,

        public readonly Carbon $sunrise,

        public readonly Carbon $sunset,

        public readonly Carbon $calculatedAt
    ) {
    }
}
```

Testing
-------

[](#testing)

```
composer review
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.1% 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 ~68 days

Recently: every ~168 days

Total

11

Last Release

482d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4eff78899d39d79e9eaf65df18ae55e18ff4be026524d311fdb178f9f2f1d0df?d=identicon)[princejohnsantillan](/maintainers/princejohnsantillan)

---

Top Contributors

[![princejohnsantillan](https://avatars.githubusercontent.com/u/60916966?v=4)](https://github.com/princejohnsantillan "princejohnsantillan (32 commits)")[![IronSinew](https://avatars.githubusercontent.com/u/1117036?v=4)](https://github.com/IronSinew "IronSinew (1 commits)")[![valeriitkachenko](https://avatars.githubusercontent.com/u/32168015?v=4)](https://github.com/valeriitkachenko "valeriitkachenko (1 commits)")

---

Tags

apilaravelopenweather

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[essa/api-tool-kit

set of tools to build an api with laravel

52680.5k](/packages/essa-api-tool-kit)[resend/resend-laravel

Resend for Laravel

1191.4M6](/packages/resend-resend-laravel)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[simplestats-io/laravel-client

Client for SimpleStats!

4515.5k](/packages/simplestats-io-laravel-client)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)[dariusiii/tmdb-laravel

Laravel Package for TMDB ( The Movie Database ) API. Provides easy access to the wtfzdotnet/php-tmdb-api library.

1821.1k](/packages/dariusiii-tmdb-laravel)

PHPackages © 2026

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