You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The address endpoint allows you to fetch address information from the Nederland Postcode API.
58
58
59
-
You can find addresses using either the `find` method for a single address or the `list` method for multiple addresses. When you provide only the `postcode`, the `list` method will return all addresses associated with that postcode.
59
+
You can search addresses using either the `find` method for a single address or the `list` method for multiple addresses. The `find` method will throw an exception if no address is found or if multiple addresses are found for the given postcode and house number (ie. when the house number has multiple additions like A, B, C, etc.).
60
60
61
61
The following optional attributes can be requested to be included in the response:
62
62
@@ -66,7 +66,7 @@ The following optional attributes can be requested to be included in the respons
66
66
67
67
To fetch a single address for a given postcode and house number, you can use the `find` method.
68
68
69
-
The `postcode` and `number` parameters are required to fetch a single address.
69
+
The `postcode` and `number` parameters are required. The `addition` parameter is optional.
70
70
71
71
```php
72
72
use Label84\NederlandPostcode\NederlandPostcodeClient;
@@ -89,6 +89,7 @@ This will return an `Address` object like this:
89
89
Address {
90
90
postcode: "1118BN",
91
91
number: 800,
92
+
addition: null,
92
93
street: "Schiphol Boulevard",
93
94
city: "Schiphol",
94
95
municipality: "Haarlemmermeer",
@@ -104,9 +105,9 @@ When no address is found for the given postcode and number, an `AddressNotFoundE
104
105
105
106
#### Multiple Addresses
106
107
107
-
To fetch multiple addresses for a given postcode, you can use the `list` method.
108
+
To fetch multiple addresses for a given postcode and house number, you can use the `list` method.
108
109
109
-
The `postcode`parameter is required. The `number` and `addition`parameters are optional.
110
+
The `postcode`and `number` parameters are required. The `addition`parameter is optional.
110
111
111
112
```php
112
113
use Label84\NederlandPostcode\NederlandPostcodeClient;
@@ -116,8 +117,8 @@ $client = new NederlandPostcodeClient(
116
117
);
117
118
118
119
$address = $client->list(
119
-
postcode: '1118BN',
120
-
number: null,
120
+
postcode: '1015CN',
121
+
number: 10,
121
122
addition: null,
122
123
attributes: ['coordinates']
123
124
);
@@ -129,29 +130,57 @@ This will return an `AddressCollection` object like this:
129
130
AddressCollection {
130
131
items: [
131
132
Address {
132
-
postcode: "1118BN",
133
-
number: 701,
134
-
street: "Schiphol Boulevard",
135
-
city: "Schiphol",
136
-
municipality: "Haarlemmermeer",
133
+
postcode: "1015CN",
134
+
number: 10,
135
+
addition: 'A',
136
+
street: "Keizersgracht",
137
+
city: "Amsterdam",
138
+
municipality: "Amsterdam",
139
+
province: "Noord-Holland",
140
+
coordinates: Coordinates {
141
+
latitude: 52.379401496779124,
142
+
longitude: 4.889216673725493
143
+
}
144
+
},
145
+
Address {
146
+
postcode: "1015CN",
147
+
number: 10,
148
+
addition: 'B',
149
+
street: "Keizersgracht",
150
+
city: "Amsterdam",
151
+
municipality: "Amsterdam",
152
+
province: "Noord-Holland",
153
+
coordinates: Coordinates {
154
+
latitude: 52.379401496779124,
155
+
longitude: 4.889216673725493
156
+
}
157
+
},
158
+
Address {
159
+
postcode: "1015CN",
160
+
number: 10,
161
+
addition: 'C',
162
+
street: "Keizersgracht",
163
+
city: "Amsterdam",
164
+
municipality: "Amsterdam",
137
165
province: "Noord-Holland",
138
166
coordinates: Coordinates {
139
-
latitude: 52.30703569036619,
140
-
longitude: 4.755174782205992
167
+
latitude: 52.379401496779124,
168
+
longitude: 4.889216673725493
141
169
}
142
170
},
143
171
Address {
144
-
postcode: "1118BN",
145
-
number: 800,
146
-
street: "Schiphol Boulevard",
147
-
city: "Schiphol",
148
-
municipality: "Haarlemmermeer",
172
+
postcode: "1015CN",
173
+
number: 10,
174
+
addition: 'D',
175
+
street: "Keizersgracht",
176
+
city: "Amsterdam",
177
+
municipality: "Amsterdam",
149
178
province: "Noord-Holland",
150
179
coordinates: Coordinates {
151
-
latitude: 52.30528553688755,
152
-
longitude: 4.750645160863609
180
+
latitude: 52.379401496779124,
181
+
longitude: 4.889216673725493
153
182
}
154
-
}
183
+
},
155
184
]
156
185
}
157
186
```
@@ -161,7 +190,7 @@ AddressCollection {
161
190
The quota endpoint allows you to check your current API usage and limits. This endpoint does not increment your usage count.
162
191
163
192
> [!NOTE]
164
-
> Values may lag behind the actual usage. They’re cached for up to five minutes, so the `used` and `limit` numbers might not be fully up-to-date.
193
+
> Values may lag behind the actual usage. They're cached for up to five minutes, so the `used` and `limit` numbers might not be fully up-to-date.
165
194
166
195
```php
167
196
use Label84\NederlandPostcode\NederlandPostcodeClient;
@@ -214,10 +243,6 @@ When a network or HTTP error occurs during the API request, a `NederlandPostcode
0 commit comments