Download the PHP package noki/weather-data-provider without Composer
On this page you can find all versions of the php package noki/weather-data-provider. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download noki/weather-data-provider
More information about noki/weather-data-provider
Files in noki/weather-data-provider
Package weather-data-provider
Short Description Simple Laravel weather data provider
License MIT
Homepage https://github.com/novakurosevic/weather-data-provider
Informations about the package weather-data-provider
Laravel Weather Provider Package
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
You can install the package via composer:
After composer finish installation run command:
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:
Add to .env file:
Run command:
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 provider | Provider Id |
---|---|
Tomorrow IO | 1 |
AccuWeather | 2 |
How to use?
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).
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.
Config example 3: Setting of minutely and hourly weather data frequencies and turning off daily.
Config example 4: Setting of minutely and hourly weather data frequencies and turning off daily.
Config example 5: Set providing data about temperature, pressure, wind and humidity.
Config example 6: Set imperial units for weather data output.
Config example 7: Set metric units for weather data output.
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.
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.
Examples of weather data providing
#
Changelog
Please see CHANGELOG for more information on what has changed recently.
Credits
- Novak Urosevic
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of weather-data-provider with dependencies
laravel/framework Version ^11.31
symfony/console Version ^7.0
symfony/var-dumper Version ^7.0