Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/treblatechnologies/zipcode
A PHP library to search the address data for a given zip code.
https://github.com/treblatechnologies/zipcode
Last synced: about 12 hours ago
JSON representation
A PHP library to search the address data for a given zip code.
- Host: GitHub
- URL: https://github.com/treblatechnologies/zipcode
- Owner: TreblaTechnologies
- License: mit
- Created: 2021-09-03T20:27:19.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-10T16:42:23.000Z (about 3 years ago)
- Last Synced: 2024-11-19T12:51:55.007Z (1 day ago)
- Language: PHP
- Homepage: https://github.com/TreblaLabs/zipcode
- Size: 15.6 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ZipCode PHP
A PHP library to search the address data for a given zip code.
# Getting Started
## Installation
Using Composer:
``` bash
composer require trebla/zipcode
```## How to use
You can search for a zip code passing it as a parameter to `find()` method:
``` php
use Trebla\ZipCode\ZipCode;
use Trebla\ZipCode\Entities\ZipCodeEntity;public function getAddress(string $zipcode): ZipCodeEntity
{
return ZipCode::find($zipcode);
}
```You also can choose the zip code service passing it as a parameter to `find()` method:
``` php
use Trebla\ZipCode\ZipCode;
use Trebla\ZipCode\Entities\ZipCodeEntity;
use Trebla\ZipCode\Helpers\ZipCodeHelper;public function getAddress(string $zipcode): ZipCodeEntity
{
return ZipCode::find($zipcode, ZipCodeHelper::VIA_CEP);
}
```## Services available
| Service | Constant | Default |
| ------ | ------ | ------ |
| Pagar me | `ZipCodeHelper::PAGAR_ME` | X |
| Repúblic Virtual | `ZipCodeHelper::REPUBLICA_VIRTUAL` | |
| Via CEP | `ZipCodeHelper::VIA_CEP` | |