PHPackages                             noki/weather-data-provider - 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. noki/weather-data-provider

ActiveLibrary

noki/weather-data-provider
==========================

Laravel Weather Provider is simple Laravel package for weather data providing

v1.0.0(1y ago)015MITPHPPHP ^8.3

Since Mar 20Pushed 11mo ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (2)Used By (0)

Laravel Weather Provider Package
================================

[](#laravel-weather-provider-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9e04d0e3cfe91fa7c1dfc199daf5463490d1ba1954ad4dbeca4e04f6a5b9416e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f6b692f776561746865722d646174612d70726f76696465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/noki/weather-data-provider)

This is simple Laravel package for providing weather information. At this moment in version 1.0.0 there are only supported two weather providers with option to provide weather data in the past. It is possible to provide weather for last 24h with display weather data per hour or weather data for last hour by minute. New features should be added in the future.

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

[](#installation)

You can install the package via composer:

```
composer require noki/weather-data-provider
```

After composer finish installation run command:

```
composer dump-autoload
```

Go to weather providers website and register account. There you will find **api key** that you need to add to **.env** file of Laravel application.

Weather provider links:

- [Tomorrow.io](https://www.tomorrow.io/weather-api/)
- [Accuweather](https://developer.accuweather.com/)

Add to **.env** file:

```
TOMORROW_IO_API_KEY="Your Tomorrow.io api key"
ACCUWEATHER_API_KEY="Your Accuweather api key"

```

Run command:

```
php artisan optimize:clear
```

Usage
-----

[](#usage)

### Before usage

[](#before-usage)

There are required fields that you need to set in weather configuration for providing weather data.

At this moment there are two supported weather providers:

Weather providerProvider IdTomorrow IO1AccuWeather2### How to use?

[](#how-to-use)

#### Config setting

[](#config-setting)

For providing weather it is required to add provider id in WeatherConfig and longitude and latitude of location that we require weather data.

Example of config with provider Tomorrow IO (id 1) and longitude and latitude for Berlin, Germany. For longitude and latitude you can use strings and numbers (integer and float).

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043);
```

**Config example 2:** Setting of minutely, hourly and daily weather data frequencies. **Note:** Some integrations do not support all of these options. Usually all integrations support hourly weather data.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->minutely()->hourly()->daily();
```

**Config example 3:** Setting of minutely and hourly weather data frequencies and turning off daily.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->minutely()->hourly()->daily(false);
```

**Config example 4:** Setting of minutely and hourly weather data frequencies and turning off daily.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->minutely()->hourly()->daily(false);
```

**Config example 5:** Set providing data about temperature, pressure, wind and humidity.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->temperature()->pressure()->wind()->humidity();
```

**Config example 6:** Set imperial units for weather data output.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->imperial();
```

**Config example 7:** Set metric units for weather data output.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::create(1, '52.5202',13.4043)->metric();
```

**Config example 8:** Set custom settings.

Required fields:

- **provider\_id** is required,
- **config\_location** is required,
- one parameter from **config\_weather\_data** must be true
- one parameter from **config\_frequency** must be true
- **units** is by default set to metric unit, you can overwrite it if you want imperial units. Avoiding this filed will output metric units.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::fromArray([
        'provider_id' => 1,
        'config_location' => [
            'longitude' => '52.5202',
            'latitude' => '13.4043'
        ],
        'config_weather_data' => [
            'temperature' => true,
            'wind' => true,
            'pressure' => false,
            'humidity' => false
        ],
        'config_frequency' => [
            'minutely' => true,
            'hourly' => true,
            'daily' => false
        ],
        'units' => 'imperial'
    ]);
```

**Config example 9:** Set custom settings other way of setting.

Settings below will provide temperature, wind and pressure data for frequencies per minute and per hour. Units will be metric.

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;

$config = WeatherConfig::fromArray([
        'provider_id' => 1,
        'config_location' => [
            'longitude' => '52.5202',
            'latitude' => '13.4043'
        ],
        'config_weather_data' => [
            'temperature',
            'wind',
            'pressure'
        ],
        'config_frequency' => [
            'minutely',
            'hourly'
        ]
    ]);
```

#### Examples of weather data providing

[](#examples-of-weather-data-providing)

```
use Noki\WeatherDataProvider\WeatherConfig as WeatherConfig;
use Noki\WeatherDataProvider\ProviderGenerator;

$config = WeatherConfig::create(1, '52.5202','13.4043');
$provider = new ProviderGenerator($config);
// Weather data for frequencies that you have choose
$provider->selected_provider->getCustomData();
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Novak Urosevic](https://github.com/novakurosevic)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance48

Moderate activity, may be stable

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Unknown

Total

1

Last Release

425d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f7b649b2e74379ec4f29aa4951f634dc9edc9c15711d3fe4cf090d845783a46?d=identicon)[noki](/maintainers/noki)

---

Top Contributors

[![novakurosevic](https://avatars.githubusercontent.com/u/17499419?v=4)](https://github.com/novakurosevic "novakurosevic (25 commits)")

---

Tags

laravelweathernoki

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/noki-weather-data-provider/health.svg)

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

###  Alternatives

[laravel/framework

The Laravel Framework.

34.7k509.9M17.0k](/packages/laravel-framework)[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[laravel/octane

Supercharge your Laravel application's performance.

4.0k21.5M159](/packages/laravel-octane)[inertiajs/inertia-laravel

The Laravel adapter for Inertia.js.

2.4k51.5M585](/packages/inertiajs-inertia-laravel)[spatie/laravel-ignition

A beautiful error page for Laravel applications.

573146.7M471](/packages/spatie-laravel-ignition)[spatie/ignition

A beautiful error page for PHP applications.

511147.6M69](/packages/spatie-ignition)

PHPackages © 2026

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