PHP code example of voyage / silverstripe-nzpost-addressfinder

1. Go to this page and download the library: Download voyage/silverstripe-nzpost-addressfinder 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/ */

    

voyage / silverstripe-nzpost-addressfinder example snippets


$field = AddressFinderField::create('AddressFinderField', 'Search for an address')
  ->setFieldMap([
    "FormField_AddressLine1" => "AddressLine1",
    "FormField_AddressLine2" => "AddressLine2",
    "FormField_City" => "CityTown",
    "FormField_Postcode" => "Postcode"
  ]);
json
"DPID": 3111226,
"AddressLine1": "7 Waterloo Quay",
"AddressLine2": "Pipitea",
"AddressLine3": "Wellington 6011",
"AddressLine4": null,
"AddressLine5": null,
"Postcode": "6011",
"SourceDesc": "Postal\\Physical - Not Delivered",
"Deliverable": "N",
"Physical": "Y",
"UnitType": null,
"UnitValue": null,
"Floor": null,
"StreetNumber": 7,
"StreetAlpha": null,
"RoadName": "Waterloo",
"RoadTypeName": "Quay",
"RoadSuffixName": null,
"Suburb": "Pipitea",
"RuralDelivery": null,
"Lobby": null,
"CityTown": "Wellington",
"MailTown": null,
"BoxBagNumber": null,
"BoxBagType": null