https://github.com/gabrielmoura/laravel-cep
A simple Laravel package to get CEP information
https://github.com/gabrielmoura/laravel-cep
brasilapi cep laravel opencep postmon redis viacep
Last synced: 9 months ago
JSON representation
A simple Laravel package to get CEP information
- Host: GitHub
- URL: https://github.com/gabrielmoura/laravel-cep
- Owner: gabrielmoura
- License: mit
- Created: 2023-12-08T22:45:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T01:34:32.000Z (about 2 years ago)
- Last Synced: 2025-08-27T23:38:38.624Z (9 months ago)
- Topics: brasilapi, cep, laravel, opencep, postmon, redis, viacep
- Language: PHP
- Homepage: https://packagist.org/packages/gabrielmoura/laravel-cep
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel CEP: A Robust CEP Lookup Package
A comprehensive Laravel package for fetching Brazilian zip code (CEP) information from multiple providers, offering seamless caching and flexibility.
## Features
* **Multiple Providers:** Integrates with:
* [ViaCEP](https://viacep.com.br/)
* [Postmon](https://postmon.com.br/)
* [Open CEP](https://opencep.com/)
* [Brasil API](https://brasilapi.com.br/)
* **Intelligent Caching:** Streamlines performance with optional Redis caching.
* **Ease of Use:** Simple interface via container or facade.
* **Customizable:** Configure the preferred provider.
## Installation
```bash
composer require gabrielmoura/laravel-cep
```
## Configuration
Publish the configuration file (optional):
```bash
php artisan vendor:publish --provider="Gabrielmoura\LaravelCep\CepServiceProvider"
```
In your `config/services.php`, adjust the default provider if desired:
```php
'cep' => [
'endpoint' => \Gabrielmoura\LaravelCep\EndpointOption::POSTMON, // Example: Change to your preferred provider
],
```
**Strongly consider installing `illuminate/redis` for automatic caching.**
## Usage
**Container:**
```php
use Gabrielmoura\LaravelCep\CepService;
$cepData = app(CepService::class)->find('01001000', true); // Enable caching
```
**Facade:**
```php
use Gabrielmoura\LaravelCep\Cep;
$cepData = Cep::find('01001000', true); // Enable caching
```
## Compatibility
* Laravel 10.x
## Contributing
We welcome contributions! Please refer to our [CONTRIBUTING.md](./CONTRIBUTING.md)
## License
Laravel CEP is released under the MIT License.