Download the PHP package mrcnpdlk/weather-api without Composer
On this page you can find all versions of the php package mrcnpdlk/weather-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package weather-api
WEATHER API - (not only) Polish weather + air quality
Contents
- Installation
- Basic usage
- Cache
- Logger
- External sources
- Chief Inspectorate of Environmental Protection
- Airly
- Open Weather Map
- API Usage
- Create instance
- Available methods
- Examples
Installation
Install the latest version with composer
Basic usage
Cache
Library supports Cache bundles based on PSR-16 standard.
For below example was used phpfastcache/phpfastcache V7.
phpfastcache/phpfastcache
supports a lot of endpoints, i.e. Files
, Sqlite
, Redis
and many other.
More information about using cache and configuration it you can find in this Wiki.
Log
Library also supports logging packages based on PSR-3 standard, i.e. very popular monolog/monolog.
External sources
GIOS
GIOS (Chief Inspectorate of Environmental Protection - Główny Inspektorat Ochrony Środowiska) provide API without any authentication.
Airly
Airly builds networks of air quality sensors that can be deployed across entire cities or counties. If you want to use external data using this API you have to get the free Token key from here .
OWM
Open Weather Map is well know project for weather and forecast. To use it, get the free Token Key from here .
API usage
Create instance
By default API uses:
- current geo location found using public IP of machine where script is run
- current date of machine where script is run
We are able to change location calling setLocation()
method.
Methods
Name | Description | Uses external sources? |
---|---|---|
getAddress() | Getting address using revers geocode | no |
getSunSchedule() | Getting surise, sunset, twilight timing etc | no |
getNearestGiosStation() | Getting nearest GIOS station | no |
getUVIndex() | UV Index | yes, OWM |
getWeather() | weather | yes, OWM |
Examples
getAddress()
getSunSchedule()
Method can give inappropriate results for location near pole.
getUVIndex()
getNearestGiosStation()
mrcnpdlk\Weather\NativeModel\Gios\Station
has implemented two methods:
Name | Description |
---|---|
getAirQualityIndex() | Return air quality index |
getSensors() | Return list of available sensors for station |
For each sensor getData()
method return list of historical measurement data.
Native API
All versions of weather-api with dependencies
ext-curl Version *
mrcnpdlk/psr16cache-adapter Version ~0.1.1
php-curl-class/php-curl-class Version ~8.0.3
mjaschen/phpgeo Version ^2.0.2
nesbot/carbon Version ^1.29.2
netresearch/jsonmapper Version ^1.4.0