PHP code example of sprained / calculo-frete

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

    

sprained / calculo-frete example snippets

 php
e Sprained\Correios\Cep;

$cep = new Cep();

/*
    Retorna endereço pelo CEP
    Parâmetro: CEP com hífen ou sem o mesmo
*/
$retorno = $cep->cep('51021-020');

/*
stdClass Object
(
    [cep] => 51021-020
    [logradouro] => Avenida Conselheiro Aguiar
    [complemento] => de 3812/3813 ao fim
    [bairro] => Boa Viagem
    [localidade] => Recife
    [uf] => PE
    [ibge] => 2611606
    [gia] => 
    [ddd] => 81
    [siafi] => 2531
)
*/