Simple zip code consult with ViaCEP.

1.1 2023-09-14 20:04 UTC

This package is auto-updated.

Last update: 2024-12-14 23:14:38 UTC


README

Paradise Sessions

Installation  |   Technologies  |   Using  |   Tests

Version PHP Version License

Project

Simple class for zip code query in the ViaCEP public API.

Classe simples para consulta de CEP na api publica do ViaCEP.

Installation

By Composer

Via Composer

composer require paradisesessions/cep

Technologies

Using

Example of use for a simple query.

Exemplo de uso para uma simples consulta.

$cep = new \ParadiseSessions\Cep\Cep();
if (!$cep->consult('04538133')) {
    exit($cep->fail()->getMessage());
}

var_dump($cep->data());

echo "<p>Address: {$cep->address} {$cep->complement}, {$cep->city} - {$cep->state}</p>";
echo "<p>Zip code: {$cep->format()}";
*you can pass the formatted zip code and it will work.

Pode passar o CEP formatado que funcionará.

Tests

Test class with Pest.

Testes na classe realizados com Pest.

composer test