PHP code example of api-postcode / api-postcode-bundle

1. Go to this page and download the library: Download api-postcode/api-postcode-bundle 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/ */

    

api-postcode / api-postcode-bundle example snippets

 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new ApiPostcode\PostcodeBundle\ApiPostcodeBundle(),
    );
}
 php
$address = $this->get('api.postcode')->fetchAddress('1012JS', 1);
	
$address->getStreet();      // Dam
$address->getCity();        // Amsterdam
$address->getHouseNumber(); // 1
$address->getZipCode();     // 1012JS
$address->getLongitude();   // 4.4584
$address->getLatitude();    // 52.2296