PHP code example of saade / cep-php

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

    

saade / cep-php example snippets


use Saade\Cep\Cep;

$cep = Cep::get('28895-190');

$cep->cep; // 28895190
$cep->state; // RJ
$cep->city; // Rio das Ostras
$cep->neighborhood; // Costazul
$cep->street; // Rua Nelson Pecegueiro do Amaral
$cep->provider; // open-cep / correios / viacep / widenet / correios-alt / brasil-api

use Saade\Cep\Cep;
use Saade\Cep\Providers\BrasilApiProvider;
use Saade\Cep\Providers\ViaCepProvider;

$cep = Cep::race('28895-190', [ViaCepProvider::class, BrasilApiProvider::class]);

use Saade\Cep\Providers\ViaCepProvider;

$cep = ViaCepProvider::get('28895-190');
bash
composer