PHP code example of label84 / laravel-nederland-postcode
1. Go to this page and download the library: Download label84/laravel-nederland-postcode library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
label84 / laravel-nederland-postcode example snippets
use Label84\NederlandPostcode\Laravel\Facades\NederlandPostcode;
$address = NederlandPostcode::find(
postcode: '1118BN',
number: 800,
addition: null,
attributes: [
AddressAttributesEnum::COORDINATES,
]
);
Address {
postcode: "1118BN",
number: 800,
addition: null,
street: "Schiphol Boulevard",
city: "Schiphol",
municipality: "Haarlemmermeer",
province: "Noord-Holland",
coordinates: Coordinates {
latitude: 52.30528553688755,
longitude: 4.750645160863609
},
district: District {
official: "Schiphol",
name: "Schiphol"
},
function: "kantoorfunctie",
location_status: "verblijfsobject in gebruik",
property_status: "pand in gebruik",
surface_area: 10398.0,
construction_year: 2019
}
use Label84\NederlandPostcode\Laravel\Facades\NederlandPostcode;
$addresses = NederlandPostcode::list(
postcode: '1015CN',
number: 10,
addition: null,
attributes: [
'coordinates',
]
);
AddressCollection {
items: [
Address {
postcode: "1015CN",
number: 10,
addition: 'A',
street: "Keizersgracht",
city: "Amsterdam",
municipality: "Amsterdam",
province: "Noord-Holland",
coordinates: Coordinates {
latitude: 52.379401496779124,
longitude: 4.889216673725493
},
...
},
Address {
postcode: "1015CN",
number: 10,
addition: 'B',
street: "Keizersgracht",
city: "Amsterdam",
municipality: "Amsterdam",
province: "Noord-Holland",
coordinates: Coordinates {
latitude: 52.379401496779124,
longitude: 4.889216673725493
},
...
}, {
...
},
...
]
}
use Label84\NederlandPostcode\Laravel\Facades\NederlandPostcode;
$energyLabels = NederlandPostcode::energyLabels()->get(
postcode: '1118BN',
number: 800,
addition: null,
);
EnergyLabelCollection {
items: [
EnergyLabel {
postcode: "1118BN",
number: 800,
addition: null,
street: "Schiphol Boulevard",
city: "Schiphol",
registrationDate: DateTime("2022-08-30"),
inspectionDate: DateTime("2022-08-02"),
validUntilDate: DateTime("2032-08-02"),
constructionType: "utiliteitsbouw",
buildingType: null,
energyLabel: "A+++",
calculationType: "NTA 8800:2022 (basisopname utiliteitsbouw)",
inspectionType: "basis",
status: "bestaand",
constructionYear: 2019,
usageAreaThermalZone: 5648.39,
compactness: 1.16,
energyDemand: 98.4,
energyDemandRequirement: null,
primaryFossilEnergy: 55.48,
primaryFossilEnergyRequirement: null,
primaryFossilEnergyEmg: null,
renewableShare: 55.3,
renewableShareRequirement: null,
renewableShareEmg: null,
calculatedEnergyConsumption: 55.48,
heatDemand: 55.02,
calculatedCo2Emission: 13.01,
temperatureExcess: 0,
temperatureExcessRequirement: null
}, {
...
}
]
}
use Label84\NederlandPostcode\Laravel\Facades\NederlandPostcode;
$quota = NederlandPostcode::usage();
Quota {
used: 1500,
limit: 10000,
}
use Label84\NederlandPostcode\Exceptions\NederlandPostcodeException;
try {
$addresses = NederlandPostcode::find(
postcode: 'INVALID',
number: 123,
addition: null,
);
} catch (NederlandPostcodeException $exception) {
// handle error
}
bash
php artisan vendor:publish --provider="Label84\NederlandPostcode\Laravel\NederlandPostcodeServiceProvider" --tag="config"