Skip to content

Search for Brazilian addresses by zip code using the ViaCEP REST API.

License

Notifications You must be signed in to change notification settings

Lukaum/viacep-php

 
 

Repository files navigation

ViaCEP PHP SDK

Latest Version on Packagist CircleCI Codecov Software License Total Downloads

Search for addresses by zip code using the ViaCEP REST API.

Install

Via Composer

$ composer require flyingluscas/viacep-php

Usage

use FlyingLuscas\ViaCEP\ZipCode;

$zipcode = new ZipCode;

Array

$address = $zipcode->find('01001-000')->toArray();

/*
The returned result would be something like this:

[
    'zipCode' => '01001-000',
    'street' => 'Praça da Sé',
    'complement' => 'lado ímpar',
    'neighborhood' => 'Sé',
    'city' => 'São Paulo',
    'state' => 'SP',
    'ibge' => '3550308',
]
*/

JSON

$address = $zipcode->find('01001-000')->toJson();

/*
The returned result would be something like this:

{
    "zipCode": "01001-000",
    "street": "Praça da Sé",
    "complement": "lado ímpar",
    "neighborhood": "Sé",
    "city": "São Paulo",
    "state": "SP",
    "ibge": "3550308"
}
*/

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email lucas.pires.mattos@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

Search for Brazilian addresses by zip code using the ViaCEP REST API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%