Skip to content

Commit 2ca797f

Browse files
committed
update readme
1 parent de000a3 commit 2ca797f

File tree

2 files changed

+78
-3
lines changed

2 files changed

+78
-3
lines changed

README.md

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Laravel [Open Weather](https://openweathermap.org/) API
2-
2+
Laravel OpenWeather API (openweather-laravel-api) is a Laravel package to connect Open Weather Map APIs ( https://openweathermap.org/api ) and access free API services easily.
33

44
## Supported APIs
5-
| Operation | English Input |
5+
| APIs | Get data by |
66
| --- | --- |
77
| [Current Weather](https://openweathermap.org/current) | By city name, city ID, geographic coordinates, ZIP code |
88
| [One Call API](https://openweathermap.org/api/one-call-api) | By geographic coordinates|
@@ -167,6 +167,49 @@ $info = $wt->get3HourlyByCord(23.7104, 90.4074);
167167

168168
```
169169

170+
### [5 Day Historical](https://openweathermap.org/api/one-call-api#history)
171+
Get access to historical weather data for the previous 5 days.
172+
173+
```php
174+
175+
// By coordinates : latitude, longitude and date
176+
$info = $wt->getHistoryByCord(23.7104, 90.4074, '2020-01-09');
177+
178+
```
179+
180+
### [Air Pollution](https://openweathermap.org/api/one-call-api#history)
181+
Air Pollution API provides current, forecast and historical air pollution data for any coordinates on the globe
182+
183+
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).
184+
185+
Air pollution forecast is available for 5 days with hourly granularity. Historical data is accessible from 27th November 2020.
186+
187+
```php
188+
189+
// By coordinates : latitude, longitude and date
190+
$info = $wt->getAirPollutionByCord(23.7104, 90.4074);
191+
192+
```
193+
194+
### [Geocoding API](https://openweathermap.org/api/one-call-api#history)
195+
Geocoding API is a simple tool that we have developed to ease the search for locations while working with geographic names and coordinates.
196+
-> Direct geocoding converts the specified name of a location or area into the exact geographical coordinates;
197+
-> Reverse geocoding converts the geographical coordinates into the names of the nearby locations.
198+
199+
```php
200+
// By city name
201+
$info = $wt->getGeoByCity('dhaka');
202+
203+
// By coordinates : latitude, longitude and date
204+
$info = $wt->getGeoByCity(23.7104, 90.4074);
205+
206+
```
207+
208+
### [Free API Limitations](https://openweathermap.org/api/one-call-api#history)
209+
- 60 calls/minute
210+
- 1,000,000 calls/month
211+
- 1000 calls/day when using Onecall requests
212+
170213

171214

172215
## License

src/config/openweather.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,43 @@
11
<?php
22

33
return [
4+
5+
/**
6+
* Get a free Open Weather Map API key : https://openweathermap.org/price.
7+
*
8+
*/
9+
410
'api_key' => 'ae9f7b6a0cfc2563ec1d24f3c267ad42',
5-
'lang' => 'en',
11+
12+
13+
/**
14+
*
15+
* Library https://openweathermap.org/current#multi
16+
* af - Afrikaans
17+
al - Albanian
18+
ar - Arabic
19+
az - Azerbaijani
20+
bg - Bulgarian
21+
............
22+
more availabe language
23+
*
24+
*/
25+
26+
'lang' => 'en',
27+
628
'date_format' => 'm/d/Y',
729
'time_format' => 'h:i A',
830
'day_format' => 'l',
31+
32+
/**
33+
* Units: available units are c, f, k.
34+
*
35+
* For temperature in Fahrenheit (f) and wind speed in miles/hour, use units=imperial
36+
* For temperature in Celsius (c) and wind speed in meter/sec, use units=metric
37+
* Temperature in Kelvin (k) and wind speed in meter/sec is used by default, so there is no need to use the units parameter in the API call if you want this
38+
*
39+
*/
40+
941
'temp_format' => 'c'
1042
];
1143

0 commit comments

Comments
 (0)