PHPackages                             rakibdevs/openweather-laravel-api - 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. rakibdevs/openweather-laravel-api

ActiveLibrary[API Development](/categories/api)

rakibdevs/openweather-laravel-api
=================================

Laravel package to connect https://openweathermap.org/ to get customized weather data for any location on the globe immediately

v1.9.0(3y ago)7648.2k—3.3%9[2 issues](https://github.com/RakibDevs/openweather-laravel-api/issues)MITPHPPHP ^7.2|^7.3|^7.4|^8.0

Since Jan 9Pushed 2y ago2 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (14)Used By (0)

Laravel [Open Weather](https://openweathermap.org/) API
-------------------------------------------------------

[](#laravel-open-weather-api)

[![Packagist](https://camo.githubusercontent.com/3db2f61286183e6dbea96ebb3bb300e0a0ca9d3b613a80513c78b009439e3ed3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)](https://camo.githubusercontent.com/3db2f61286183e6dbea96ebb3bb300e0a0ca9d3b613a80513c78b009439e3ed3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)[![GitHub stars](https://camo.githubusercontent.com/9d3a95bb9ebf076677e0d08d83c3cad5456619a219f8460fd82fb5f1bbbae0e8/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)](https://github.com/rakibdevs/openweather-laravel-api/stargazers)[![GitHub forks](https://camo.githubusercontent.com/411213d1aa7be70aac0aedabfebc5afcc8e97b099472992f4b432507eca5a0ec/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)](https://github.com/rakibdevs/openweather-laravel-api/network)[![GitHub issues](https://camo.githubusercontent.com/73fff5a13370537a516e610e9326f24f8e2b1204f0702a7ccdcab64ea0646e34/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)](https://github.com/rakibdevs/openweather-laravel-api/issues)[![GitHub license](https://camo.githubusercontent.com/38e1ce62814e1c31c75a830d645bba1d6c51949efbbc93d2cd061a5277f0d744/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72616b6962646576732f6f70656e776561746865722d6c61726176656c2d617069)](https://github.com/rakibdevs/openweather-laravel-api/blob/master/LICENSE)

Laravel OpenWeather API (openweather-laravel-api) is a Laravel package to connect Open Weather Map APIs (  ) and access free API services (current weather, weather forecast, weather history) easily.

Supported APIs
--------------

[](#supported-apis)

APIsGet data by[Current Weather](https://openweathermap.org/current)By city name, city ID, geographic coordinates, ZIP code[One Call API](https://openweathermap.org/api/one-call-api)By geographic coordinates[4 Day 3 Hour Forecast](https://openweathermap.org/forecast5)By city name, city ID, geographic coordinates, ZIP code[5 Day Historical](https://openweathermap.org/api/one-call-api#history)By geographic coordinates[Air Pollution](https://openweathermap.org/api/air-pollution)By geographic coordinates[Geocoding API](https://openweathermap.org/api/geocoding-api)By geographic coordinatesInstallation
------------

[](#installation)

Install the package through [Composer](http://getcomposer.org). On the command line:

```
composer require rakibdevs/openweather-laravel-api

```

Configuration
-------------

[](#configuration)

If Laravel &gt; 7, no need to add provider

Add the following to your `providers` array in `config/app.php`:

```
'providers' => [
    // ...
    RakibDevs\Weather\WeatherServiceProvider::class,
],
'aliases' => [
    //...
    'Weather' => RakibDevs\Weather\Weather::class,
];
```

Add API key and desired language in `.env`

```
OPENWEATHER_API_KEY=
OPENWEATHER_API_LANG=en

```

Publish the required package configuration file using the artisan command:

```
	$ php artisan vendor:publish

```

Edit the `config/openweather.php` file and modify the `api_key` value with your Open Weather Map api key.

```
	return [
	    'api_key' 	        => env('OPENWEATHER_API_KEY', ''),
    	    'onecall_api_version' => '2.5',
            'historical_api_version' => '2.5',
            'forecast_api_version' => '2.5',
            'polution_api_version' => '2.5',
            'geo_api_version' => '1.0',
	    'lang' 		=> env('OPENWEATHER_API_LANG', 'en'),
	    'date_format'       => 'm/d/Y',
	    'time_format'       => 'h:i A',
	    'day_format'        => 'l',
	    'temp_format'       => 'c'         // c for celcius, f for farenheit, k for kelvin
	];
```

Now you can configure API version from config as [One Call API](https://openweathermap.org/price) is upgraded to version 3.0. Please set available api version in config.

Usage
-----

[](#usage)

Here you can see some example of just how simple this package is to use.

```
use RakibDevs\Weather\Weather;

$wt = new Weather();

$info = $wt->getCurrentByCity('dhaka');    // Get current weather by city name
```

### [Current weather](https://openweathermap.org/current)

[](#current-weather)

Access current weather data for any location on Earth including over 200,000 cities! [OpenWeather](https://openweathermap.org/) collect and process weather data from different sources such as global and local weather models, satellites, radars and vast network of weather stations

```
// By city name
$info = $wt->getCurrentByCity('dhaka');

// By city ID - download list of city id here http://bulk.openweathermap.org/sample/
$info = $wt->getCurrentByCity(1185241);

// By Zip Code - string with country code
$info = $wt->getCurrentByZip('94040,us');  // If no country code specified, us will be default

// By coordinates : latitude and longitude
$info = $wt->getCurrentByCord(23.7104, 90.4074);
```

#### Output:

[](#output)

```
{
  "coord": {
    "lon": 90.4074
    "lat": 23.7104
  }
  "weather":[
    0 => {
      "id": 721
      "main": "Haze"
      "description": "haze"
      "icon": "50d"
    }
  ]
  "base": "stations"
  "main": {
    "temp": 26
    "feels_like": 25.42
    "temp_min": 26
    "temp_max": 26
    "pressure": 1009
    "humidity": 57
  }
  "visibility": 3500
  "wind": {
    "speed": 4.12
    "deg": 280
  }
  "clouds": {
    "all": 85
  }
  "dt": "01/09/2021 04:16 PM"
  "sys": {
    "type": 1
    "id": 9145
    "country": "BD"
    "sunrise": "01/09/2021 06:42 AM"
    "sunset": "01/09/2021 05:28 PM"
  }
  "timezone": 21600
  "id": 1185241
  "name": "Dhaka"
  "cod": 200
}

```

### [One Call API](https://openweathermap.org/api/one-call-api)

[](#one-call-api)

Make just one API call and get all your essential weather data for a specific location with OpenWeather One Call API.

```
// By coordinates : latitude and longitude
$info = $wt->getOneCallByCord(23.7104, 90.4074);
```

### [4 Day 3 Hour Forecast](https://openweathermap.org/forecast5)

[](#4-day-3-hour-forecast)

4 day forecast is available at any location or city. It includes weather forecast data with 3-hour step.

```
// By city name
$info = $wt->get3HourlyByCity('dhaka');

// By city ID - download list of city id here http://bulk.openweathermap.org/sample/
$info = $wt->get3HourlyByCity(1185241);

// By Zip Code - string with country code
$info = $wt->get3HourlyByZip('94040,us');  // If no country code specified, us will be default

// By coordinates : latitude and longitude
$info = $wt->get3HourlyByCord(23.7104, 90.4074);
```

### [5 Day Historical](https://openweathermap.org/api/one-call-api#history)

[](#5-day-historical)

Get access to historical weather data for the previous 5 days.

```
// By coordinates : latitude, longitude and date
$info = $wt->getHistoryByCord(23.7104, 90.4074, '2020-01-09');
```

### [Air Pollution](https://openweathermap.org/api/one-call-api#history)

[](#air-pollution)

Air Pollution API provides current, forecast and historical air pollution data for any coordinates on the globe

Besides basic Air Quality Index, the API returns data about polluting gases, such as Carbon monoxide (CO), Nitrogen monoxide (NO), Nitrogen dioxide (NO2), Ozone (O3), Sulphur dioxide (SO2), Ammonia (NH3), and particulates (PM2.5 and PM10).

Air pollution forecast is available for 5 days with hourly granularity. Historical data is accessible from 27th November 2020.

```
// By coordinates : latitude, longitude and date
$info = $wt->getAirPollutionByCord(23.7104, 90.4074);
```

### [Geocoding API](https://openweathermap.org/api/one-call-api#history)

[](#geocoding-api)

Geocoding API is a simple tool that we have developed to ease the search for locations while working with geographic names and coordinates. -&gt; Direct geocoding converts the specified name of a location or area into the exact geographical coordinates; -&gt; Reverse geocoding converts the geographical coordinates into the names of the nearby locations.

```
// By city name
$info = $wt->getGeoByCity('dhaka');

// By coordinates : latitude, longitude and date
$info = $wt->getGeoByCity(23.7104, 90.4074);
```

### [Free API Limitations](https://openweathermap.org/api/one-call-api#history)

[](#free-api-limitations)

- 60 calls/minute
- 1,000,000 calls/month
- 1000 calls/day when using Onecall requests

License
-------

[](#license)

Laravel Open Weather API is licensed under [The MIT License (MIT)](LICENSE).

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 88.5% 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 ~76 days

Recently: every ~121 days

Total

10

Last Release

1266d ago

PHP version history (3 changes)v1.0PHP ^7

v1.1PHP ^7.0|^8.0

v1.5PHP ^7.2|^7.3|^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d789cf937c914cb8a2ce0c513840be4c4558007bb36433509496587d1989fdb?d=identicon)[rakibdevs](/maintainers/rakibdevs)

---

Top Contributors

[![rakibdevs](https://avatars.githubusercontent.com/u/44586913?v=4)](https://github.com/rakibdevs "rakibdevs (54 commits)")[![Waghabond](https://avatars.githubusercontent.com/u/62872555?v=4)](https://github.com/Waghabond "Waghabond (4 commits)")[![joshuadegier](https://avatars.githubusercontent.com/u/2580917?v=4)](https://github.com/joshuadegier "joshuadegier (3 commits)")

---

Tags

apilaravelopenweathermap-apipackageweatherapilaravelweatheropen-weather

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[openai-php/laravel

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

3.7k7.6M74](/packages/openai-php-laravel)[nickurt/laravel-postcodeapi

Universal PostcodeApi for Laravel 11.x/12.x/13.x

97221.2k](/packages/nickurt-laravel-postcodeapi)[smodav/mpesa

M-Pesa API implementation

16363.7k1](/packages/smodav-mpesa)[mozex/anthropic-laravel

Anthropic PHP for Laravel is a supercharged PHP API client that allows you to interact with the Anthropic API

71226.4k1](/packages/mozex-anthropic-laravel)[gnahotelsolutions/laravel-weather

🌤️ A wrapper around Open Weather Map to get the current weather on a location.

385.3k](/packages/gnahotelsolutions-laravel-weather)[scriptdevelop/whatsapp-manager

Paquete para manejo de WhatsApp Business API en Laravel

762.6k](/packages/scriptdevelop-whatsapp-manager)

PHPackages © 2026

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