14
14
- [ getHistory] ( #gethistory )
15
15
- [ Geocoding] ( #geocoding )
16
16
- [ getByLocationName] ( #getbylocationname )
17
- - [ getByZipCode] ( #getbyzipcode )
18
17
- [ getByCoordinate] ( #getbycoordinate )
18
+ - [ getByZipCode] ( #getbyzipcode )
19
19
- [ Common Methods] ( #common-methods )
20
20
- [ withUnitSystem] ( #withunitsystem )
21
21
- [ withLanguage] ( #withlanguage )
@@ -33,7 +33,7 @@ getWeather(float $latitude, float $longitude): OneCall
33
33
34
34
Get current and forecast (minutely, hourly and daily) weather data.
35
35
36
- Returns a [ ` OneCall ` ] ( 05-objects.md #onecall ) object:
36
+ Returns a [ ` OneCall ` ] ( 05-entities #onecall ) object:
37
37
38
38
``` php
39
39
$weather = $openWeatherMap->oneCall()->getWeather(50, 50);
@@ -49,7 +49,7 @@ getHistoryMoment(float $latitude, float $longitude, \DateTimeInterface $dateTime
49
49
50
50
Get weather data from a single moment in the past.
51
51
52
- Returns a [ ` WeatherLocation ` ] ( 05-objects.md #weatherlocation ) object:
52
+ Returns a [ ` WeatherLocation ` ] ( 05-entities #weatherlocation ) object:
53
53
54
54
``` php
55
55
$weather = $openWeatherMap->oneCall()->getHistoryMoment(50, 50, new \DateTime('2023-01-01 12:00:00'));
@@ -65,7 +65,7 @@ getHistoryAggregate(float $latitude, float $longitude, \DateTimeInterface $date)
65
65
66
66
Get aggregated weather data from a single day in the past.
67
67
68
- Returns a [ ` WeatherAggregate ` ] ( 05-objects.md #weatheraggregate ) object:
68
+ Returns a [ ` WeatherAggregate ` ] ( 05-entities #weatheraggregate ) object:
69
69
70
70
``` php
71
71
$weather = $openWeatherMap->oneCall()->getHistoryAggregate(50, 50, new \DateTime('1985-07-19'));
@@ -83,7 +83,7 @@ getCurrent(float $latitude, float $longitude): WeatherLocation
83
83
84
84
Get current weather data.
85
85
86
- Returns a [ ` WeatherLocation ` ] ( 05-objects.md #weatherlocation-1 ) object:
86
+ Returns a [ ` WeatherLocation ` ] ( 05-entities #weatherlocation-1 ) object:
87
87
88
88
``` php
89
89
$weather = $openWeatherMap->weather()->getCurrent(50, 50);
@@ -99,7 +99,7 @@ getForecast(float $latitude, float $longitude, int $numResults = 40): WeatherLoc
99
99
100
100
Get weather forecast data per 3-hour steps for the next 5 days.
101
101
102
- Returns a [ ` WeatherLocationList ` ] ( 05-objects.md #weatherlocationlist ) object:
102
+ Returns a [ ` WeatherLocationList ` ] ( 05-entities #weatherlocationlist ) object:
103
103
104
104
``` php
105
105
// Since it returns 3-hour steps,
@@ -122,7 +122,7 @@ getCurrent(float $latitude, float $longitude): AirPollutionLocation
122
122
123
123
Get current air pollution data.
124
124
125
- Returns a [ ` AirPollutionLocation ` ] ( 05-objects.md #airpollutionlocation ) object:
125
+ Returns a [ ` AirPollutionLocation ` ] ( 05-entities #airpollutionlocation ) object:
126
126
127
127
``` php
128
128
$airPollution = $openWeatherMap->airPollution()->getCurrent(50, 50);
@@ -139,7 +139,7 @@ getForecast(float $latitude, float $longitude): AirPollutionLocationList
139
139
140
140
Get air pollution forecast data per 1-hour for the next 24 hours.
141
141
142
- Returns a [ ` AirPollutionLocationList ` ] ( 05-objects.md #airpollutionlocationlist ) object:
142
+ Returns a [ ` AirPollutionLocationList ` ] ( 05-entities #airpollutionlocationlist ) object:
143
143
144
144
``` php
145
145
$airPollutionForecast = $openWeatherMap->airPollution()->getForecast(50, 50);
@@ -159,7 +159,7 @@ getHistory(float $latitude, float $longitude, \DateTimeInterface $startDate, \Da
159
159
160
160
Get air pollution history data between two dates.
161
161
162
- Returns a [ ` AirPollutionLocationList ` ] ( 05-objects.md #airpollutionlocationlist ) object:
162
+ Returns a [ ` AirPollutionLocationList ` ] ( 05-entities #airpollutionlocationlist ) object:
163
163
164
164
``` php
165
165
$startDate = new \DateTime('-7 days'); // 7 days ago
@@ -177,62 +177,44 @@ foreach ($airPollutionHistory->getList() as $airPollution) {
177
177
178
178
#### ` getByLocationName `
179
179
180
+ Get locations by location name. Returns an array of [ ` Location ` ] ( 05-entities#location ) entities:
181
+
180
182
``` php
181
183
/**
182
184
* @return Location[]
183
185
*/
184
186
getByLocationName(string $locationName, int $numResults = 5): array
185
187
```
186
188
187
- Get locations data by location name.
188
-
189
- Returns an array of [ ` Location ` ] ( 05-objects.md#location ) objects:
190
-
191
- ``` php
192
- $locations = $openWeatherMap->geocoding()->getByLocationName('lisbon');
193
-
194
- foreach ($locations as $location) {
195
- echo $location->getName();
196
- echo $location->getCountryCode();
197
- }
198
- ```
199
-
200
- #### ` getByZipCode `
201
-
202
- ``` php
203
- getByZipCode(string $zipCode, string $countryCode): ZipCodeLocation
204
- ```
205
-
206
- Get location data by zip/post code.
207
-
208
- Returns a [ ` ZipCodeLocation ` ] ( 05-objects.md#zipcodelocation ) object:
209
-
210
189
``` php
211
- $location = $openWeatherMap->geocoding()->getByZipCode('1000-001', 'pt');
212
-
213
- echo $location->getName();
190
+ $api->geocoding()->getByLocationName('lisbon');
214
191
```
215
192
216
193
#### ` getByCoordinate `
217
194
195
+ Get locations by coordinate. Returns an array of [ ` Location ` ] ( 05-entities#location ) entities:
196
+
218
197
``` php
219
198
/**
220
199
* @return Location[]
221
200
*/
222
201
getByCoordinate(float $latitude, float $longitude, int $numResults = 5): array
223
202
```
224
203
225
- Get locations data by coordinate.
204
+ ``` php
205
+ $api->geocoding()->getByCoordinate(50, 50);
206
+ ```
207
+
208
+ #### ` getByZipCode `
226
209
227
- Returns an array of [ ` Location ` ] ( 05-objects.md #location ) objects :
210
+ Get location by zip code. Returns a [ ` Location ` ] ( 05-entities #location ) entity :
228
211
229
212
``` php
230
- $locations = $openWeatherMap->geocoding()->getByCoordinate(50, 50);
213
+ getByZipCode(string $zipCode, string $countryCode): Location
214
+ ```
231
215
232
- foreach ($locations as $location) {
233
- echo $location->getName();
234
- echo $location->getCountryCode();
235
- }
216
+ ``` php
217
+ $api->geocoding()->getByZipCode('1000-001', 'pt');
236
218
```
237
219
238
220
## Common Methods
0 commit comments