PHP code example of mero / correios
1. Go to this page and download the library: Download mero/correios 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/ */
mero / correios example snippets
$correios = new \Mero\Correios\Client();
$address = $correios->findAddressByZipCode('22640102'); // Return Address object related to '22640-102' zip-code.
echo $address->getAddress(); // Return the address 'Avenida das Américas'
echo $address->getNeighborhood(); // Return the neighborhood 'Barra da Tijuca'
echo $address->getCity(); // Return the city 'Rio de Janeiro'
echo $address->getState(); // Return the state 'RJ'
echo $address->getZipCode(); // Return the address '22640102'