PHPackages                             euregistro/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. [API Development](/categories/api)
4. /
5. euregistro/viacep-php

ActiveLibrary[API Development](/categories/api)

euregistro/viacep-php
=====================

ViaCEP PHP SDK

013PHP

Since Aug 30Pushed 3y agoCompare

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

READMEChangelogDependenciesVersions (1)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 euregistro/viacep-php
```

Usage
-----

[](#usage)

### findByZipCode

[](#findbyzipcode)

Find address by zip code.

```
use Euregistro\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 Euregistro\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

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 83.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f07b581578d67231e8af40312878bf43aefdcf17bd62f21ea60e6b535d405e4f?d=identicon)[marcio\_ce](/maintainers/marcio_ce)

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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