https://github.com/blancohugo/correios
A service for fetching data from an address from a provided zip code.
https://github.com/blancohugo/correios
cep correios correios-cep php zipcode
Last synced: 28 days ago
JSON representation
A service for fetching data from an address from a provided zip code.
- Host: GitHub
- URL: https://github.com/blancohugo/correios
- Owner: blancohugo
- License: mit
- Created: 2018-09-09T21:17:53.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-09-25T20:23:02.000Z (over 7 years ago)
- Last Synced: 2024-11-08T12:46:30.609Z (over 1 year ago)
- Topics: cep, correios, correios-cep, php, zipcode
- Language: PHP
- Homepage:
- Size: 21.5 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Correios zip code query with PHP
[![Latest version][icon-packagist]][link-packagist]
[![CircleCI][icon-circleci]][link-circleci]
[![Code Coverage][icon-codecov]][link-codecov]
[![Download count][icon-downloads]][link-packagist]
A service for fetching data from an address from a provided zip code.
## Installation
``` bash
$ composer require blancohugo/correios
```
## How-to
See the example below of how to implement a search for address data:
``` php
query(new Zipcode('01311-929'));
```
The client class uses exceptions for data treatments. Make sure your code will have a treatment for the following situations:
``` php
query(new Zipcode('01311-929'));
} catch (Exception\InvalidZipcodeException $e) {
// Invalid zipcode
} catch (Exception\ZipcodeNotFoundException $e) {
// Address data not found
} catch (Exception\UnexpectedResponseException $e) {
// Unexpected response from SIGEP
}
```
## Contributing
See how to [CONTRIBUTE](https://github.com/blancohugo/correios/blob/master/CONTRIBUTING.md) to this project.
[icon-packagist]: https://img.shields.io/packagist/v/blancohugo/correios.svg?style=flat-square
[icon-circleci]: https://img.shields.io/circleci/project/github/blancohugo/correios.svg?style=flat-square
[icon-codecov]: https://img.shields.io/codecov/c/github/blancohugo/correios.svg?style=flat-square
[icon-downloads]: https://img.shields.io/packagist/dt/blancohugo/correios.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/blancohugo/correios
[link-circleci]: https://circleci.com/gh/blancohugo/correios
[link-codecov]: https://codecov.io/gh/blancohugo/correios