PHPackages                             flyingluscas/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. flyingluscas/viacep-php

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

flyingluscas/viacep-php
=======================

ViaCEP PHP SDK

v2.0.0(6y ago)3640.2k↓33.3%13[2 issues](https://github.com/flyingluscas/viacep-php/issues)MITPHPPHP ~5.6|~7.0

Since Nov 11Pushed 6y ago4 watchersCompare

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

READMEChangelog (4)Dependencies (4)Versions (5)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

37

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity40

Moderate usage in the ecosystem

Community13

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~339 days

Total

4

Last Release

2449d ago

Major Versions

v1.1.0 → v2.0.02019-08-25

### Community

Maintainers

![](https://www.gravatar.com/avatar/8ba942efed17b9d3243112edc08235c3cd082729ab59397e6f9b12acd126f204?d=identicon)[flyingluscas](/maintainers/flyingluscas)

---

Top Contributors

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

---

Tags

addressbrazilcepphpviacepaddresscepzipcodebrazilviacepflyingluscasenderecos

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[flyingluscas/correios-php

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

141362.4k3](/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.

159301.8k](/packages/cagartner-correios-consulta)[pragmarx/zipcode

A worldwide address-by-zipcode searcher.

10265.4k](/packages/pragmarx-zipcode)[jarouche/viacep

Classe para pesquisar o CEP atraves do servico gratuito viacep

3324.4k](/packages/jarouche-viacep)[lsnepomuceno/laravel-brazilian-ceps

A package for querying zip codes for Brazilian addresses.

322.4k](/packages/lsnepomuceno-laravel-brazilian-ceps)

PHPackages © 2026

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