PHP code example of ernandesrs / viacep

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

    

ernandesrs / viacep example snippets




use ErnandesRS\ViaCEP\ViaCEP;

/
echo "Consultando CEP válido\n";
$cep = ViaCEP::consultarCep("01001000");
print_r($cep);

/**
 * Consultando um CEP válido
 */
echo "Consultando CEP válido\n";
$cep = ViaCEP::consultarCep("01001-000");
print_r($cep);



use ErnandesRS\ViaCEP\ViaCEP;

ndo um CEP com endereço\n";
$cep = ViaCEP::obterCep("MS", "Dourados", "Weimar Torres");
print_r($cep);