PHPackages                             jhernandes/viacep-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jhernandes/viacep-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jhernandes/viacep-php
=====================

ViaCEP PHP SDK

v1.0.4(2y ago)020MITPHPPHP ~5.6|~7.0|^8.0

Since Jun 12Pushed 2y agoCompare

[ Source](https://github.com/jhernandes/viacep-php)[ Packagist](https://packagist.org/packages/jhernandes/viacep-php)[ Docs](https://github.com/jhernandes/viacep-php)[ RSS](/packages/jhernandes-viacep-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (4)Versions (6)Used By (0)

ViaCEP PHP SDK
==============

[](#viacep-php-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/845494e22a7ac92b1e4b45e95fe08b9b1216731ea89c22b8e764de89fd3881e4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666c79696e676c75736361732f7669616365702d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flyingluscas/viacep-php)[![CircleCI](https://camo.githubusercontent.com/8a6b9e8c5ec6e51d090a5f512fdd92979ad140f199958446de7154259c4974e6/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f666c79696e676c75736361732f7669616365702d7068702e7376673f7374796c653d666c61742d737175617265)](https://circleci.com/gh/flyingluscas/viacep-php)[![Codecov](https://camo.githubusercontent.com/1cc598bed1a7c7fd177ed6ac0eaa03b2b991a402273b57f9f7f833d1d516a0c8/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f666c79696e676c75736361732f7669616365702d7068702e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/gh/flyingluscas/viacep-php)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/3d8d725150bf608a8c6933785f72a43090542bd25d6e5678ea7c1a13336b47b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666c79696e676c75736361732f7669616365702d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/flyingluscas/viacep-php)

Search for addresses by zip code using the [ViaCEP](https://viacep.com.br) REST API.

Install
-------

[](#install)

Via Composer

```
$ composer require flyingluscas/viacep-php
```

Usage
-----

[](#usage)

### findByZipCode

[](#findbyzipcode)

Find address by zip code.

```
use FlyingLuscas\ViaCEP\ViaCEP;

$viacep = new ViaCEP;

$address = $viacep->findByZipCode('01001-000')->toArray();

/*
Should return something like this:

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

$address = $viacep->findByZipCode('01001-000')->toJson();

/*
Should return something like this:

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

### findByStreetName

[](#findbystreetname)

Search for addresses using state, city and a street name.

```
use FlyingLuscas\ViaCEP\ViaCEP;

$viacep = new ViaCEP;

$addresses = $viacep->findByStreetName('SP', 'São Paulo', 'Gomes de Carvalho');

/*
Should return something like this:

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

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lucas Pires](https://github.com/flyingluscas)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~91 days

Total

4

Last Release

835d ago

PHP version history (2 changes)v1.0.1PHP ~5.6|~7.0

v1.0.3PHP ~5.6|~7.0|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ac6c28b4d0b70e45346ee9bb3f9bac9fa608bd1e6f10b56966413a73744d883?d=identicon)[jhernandes](/maintainers/jhernandes)

---

Top Contributors

[![flyingluscas](https://avatars.githubusercontent.com/u/6232791?v=4)](https://github.com/flyingluscas "flyingluscas (36 commits)")[![jhernandes](https://avatars.githubusercontent.com/u/6430761?v=4)](https://github.com/jhernandes "jhernandes (6 commits)")

---

Tags

addresscepzipcodebrazilviacepflyingluscasenderecos

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jhernandes-viacep-php/health.svg)

```
[![Health](https://phpackages.com/badges/jhernandes-viacep-php/health.svg)](https://phpackages.com/packages/jhernandes-viacep-php)
```

###  Alternatives

[flyingluscas/viacep-php

ViaCEP PHP SDK

3540.5k](/packages/flyingluscas-viacep-php)[flyingluscas/correios-php

Uma maneira fácil de interagir com as principais funcionalidades dos Correios.

140365.7k3](/packages/flyingluscas-correios-php)[cagartner/correios-consulta

Package para pesquisa de serviços de busca por cep, calculo de frete e etc, diretamente nos serviços dos Correios.

154302.3k](/packages/cagartner-correios-consulta)[canducci/zipcode

ZipCode From Brazil

4555.6k](/packages/canducci-zipcode)[jarouche/viacep

Classe para pesquisar o CEP atraves do servico gratuito viacep

3425.0k](/packages/jarouche-viacep)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

252.5k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
