Recommend this page to a friend! |
<h1 align="center">Search addresses easily with Laravel Brazilian CEPs</h1>
<p align="center"> <a href="https://github.com/lsnepomuceno/laravel-brazilian-ceps/releases/latest">
<img src="http://poser.pugx.org/lsnepomuceno/laravel-brazilian-ceps/v" alt="Latest Stable Version">
</a> <a href="https://packagist.org/packages/lsnepomuceno/laravel-brazilian-ceps/stats">
<img src="http://poser.pugx.org/lsnepomuceno/laravel-brazilian-ceps/downloads" alt="Total Downloads">
</a> <a href="https://github.com/lsnepomuceno/laravel-brazilian-ceps/tree/dev">
<img src="http://poser.pugx.org/lsnepomuceno/laravel-brazilian-ceps/v/unstable" alt="Latest Unstable Version">
</a> <a href="https://github.com/lsnepomuceno/laravel-brazilian-ceps/blob/main/LICENSE.md">
<img src="https://poser.pugx.org/lsnepomuceno/laravel-brazilian-ceps/license" alt="License">
</a> <a href="https://github.com/lsnepomuceno/laravel-brazilian-ceps/actions/workflows/main_action.yml">
<img src="https://github.com/lsnepomuceno/laravel-brazilian-ceps/actions/workflows/action_pr_main.yml/badge.svg?branch=main" alt="Tests">
</a> </p>
Require this package in your composer.json and update composer. This will download the package and the dependencies libraries also.
composer require lsnepomuceno/laravel-brazilian-ceps
Export the settings file using the command below
php artisan vendor:publish --tag=brazilian-ceps
<?php
use LSNepomuceno\LaravelBrazilianCeps\Services\CepService;
class ExampleController() {
// PHP 8: Constructor property promotion
public function __construct(protected CepService $cepService) { }
public function dummyFunction(string|int $cep){
$address = $this->cepService->get($cep);
dd($address);
}
}
LSNepomuceno\LaravelBrazilianCeps\Entities\CepEntity {
city: string,
cep: string,
street: string,
state: string,
uf: string,
neighborhood: string,
number: string | int | null,
complement: string | null,
}
// config/brazilian-ceps.php
<?php
'throw_not_found_exception' => true
<?php
use LSNepomuceno\LaravelBrazilianCeps\Services\CepService;
use LSNepomuceno\LaravelBrazilianCeps\Exceptions\CepNotFoundException;
class ExampleController() {
// PHP 8: Constructor property promotion
public function __construct(protected CepService $cepService) { }
public function dummyFunction(string|int $cep){
try {
$address = $this->cepService->get($cep);
dd($address);
} catch(CepNotFoundException $e) {
// TODO necessary
}
}
}
<hr>
<table> <thead>
<tr>
<th>Verb</th>
<th>URI</th>
<th>Invokable Controller</th>
<th>Route Name</th>
</tr>
</thead>
<tbody>
<tr>
<td>GET</td>
<td>api/consult-cep/{cep}</td>
<td>LSNepomuceno\LaravelBrazilianCeps\Controllers\ConsultCepController</td>
<td>consult-cep.api</td>
</tr>
</tbody> </table>
// config/brazilian-ceps.php
<?php
'enable_api_consult_cep_route' => false
// config/brazilian-ceps.php
<?php
'not_found_message' => 'Type here the message you want.'
// config/brazilian-ceps.php
<?php
'api_route_middleware' => ['guest']
<hr>
// config/brazilian-ceps.php
<?php
'cache_results' => true,
'cache_lifetime_in_days' => 30
The MIT License (MIT). Please see License File for more information.
Classes of Lucas Nepomuceno | > | Laravel Brazilian CEPs | > | Download .zip .tar.gz | > | Support forum | > | Blog | > | Latest changes |
|
Groups | Applications | Files |
Groups |
PHP 5 | Classes using PHP 5 specific features | View top rated classes |
Searching | Search engines, crawling and indexing | View top rated classes |
Web services | Web data clipping, SOAP or XML-RPC clients and servers | View top rated classes |
Geography | Locations, mapping and demographics | View top rated classes |
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (1 file, 2 directories) | ||||
src (1 file, 12 directories) | ||||
tests (1 file, 3 directories) | ||||
CODE_OF_CONDUCT.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
CONTRIBUTING.md | Data | Auxiliary data | ||
LICENSE.md | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
readme.md | Doc. | Class source |
Files | / | .github |
File | Role | Description | ||
---|---|---|---|---|
ISSUE_TEMPLATE (2 files) | ||||
workflows (1 file) | ||||
dependabot.yml | Data | Auxiliary data |
Files | / | .github | / | ISSUE_TEMPLATE |
File | Role | Description |
---|---|---|
bug_report.md | Data | Auxiliary data |
feature_request.md | Data | Auxiliary data |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
CepProviders (9 files) | ||||
Config (1 file) | ||||
Contracts (1 file) | ||||
Controllers (2 files) | ||||
Entities (1 file) | ||||
Enums (1 file) | ||||
Exceptions (1 file) | ||||
Facades (1 file) | ||||
Helpers (1 file) | ||||
Resources (1 file) | ||||
Routes (1 file) | ||||
Services (1 file) | ||||
LaravelBrazilianCepsServiceProvider.php | Class | Class source |
Files | / | src | / | CepProviders |
File | Role | Description |
---|---|---|
ApiCep.php | Class | Class source |
BaseCepProvider.php | Class | Class source |
BrasilApiV1.php | Class | Class source |
BrasilApiV2.php | Class | Class source |
CepLa.php | Class | Class source |
OpenCep.php | Class | Class source |
Pagarme.php | Class | Class source |
Postomon.php | Class | Class source |
ViaCep.php | Class | Class source |
Files | / | src | / | Controllers |
File | Role | Description |
---|---|---|
ConsultCepController.php | Class | Class source |
Controller.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
Feature (10 files) | ||||
Helpers (1 file) | ||||
Unit (5 files) | ||||
TestCase.php | Class | Class source |
Files | / | tests | / | Feature |
File | Role | Description |
---|---|---|
ApiCepProviderTest.php | Class | Class source |
BrasilApiV1ProviderTest.php | Class | Class source |
BrasilApiV2ProviderTest.php | Class | Class source |
CepFacadeTest.php | Class | Class source |
CepLaProviderTest.php | Class | Class source |
ConsultCepApiRouteTest.php | Class | Class source |
OpenCepProviderTest.php | Class | Class source |
PagarmeCepProviderTest.php | Class | Class source |
PostomonCepProviderTest.php | Class | Class source |
ViaCepProviderTest.php | Class | Class source |
Files | / | tests | / | Unit |
File | Role | Description |
---|---|---|
CepEntityTest.php | Class | Class source |
CepNotFoundExceptionTest.php | Class | Class source |
ConfigTest.php | Class | Class source |
MaskHelperTest.php | Class | Class source |
StatesEnumTest.php | Class | Class source |
Install with Composer - Download all files: laravel-brazilian-ce.tar.gz laravel-brazilian-ce.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (1 file, 2 directories) | ||||
src (1 file, 12 directories) | ||||
tests (1 file, 3 directories) | ||||
CODE_OF_CONDUCT.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
CONTRIBUTING.md | Data | Auxiliary data | ||
LICENSE.md | Lic. | License text | ||
phpunit.xml | Data | Auxiliary data | ||
readme.md | Doc. | Class source |
Files | / | .github |
File | Role | Description | ||
---|---|---|---|---|
ISSUE_TEMPLATE (2 files) | ||||
workflows (1 file) | ||||
dependabot.yml | Data | Auxiliary data |
Files | / | .github | / | ISSUE_TEMPLATE |
File | Role | Description |
---|---|---|
bug_report.md | Data | Auxiliary data |
feature_request.md | Data | Auxiliary data |
Files | / | src |
File | Role | Description | ||
---|---|---|---|---|
CepProviders (9 files) | ||||
Config (1 file) | ||||
Contracts (1 file) | ||||
Controllers (2 files) | ||||
Entities (1 file) | ||||
Enums (1 file) | ||||
Exceptions (1 file) | ||||
Facades (1 file) | ||||
Helpers (1 file) | ||||
Resources (1 file) | ||||
Routes (1 file) | ||||
Services (1 file) | ||||
LaravelBrazilianCepsServiceProvider.php | Class | Class source |
Files | / | src | / | CepProviders |
File | Role | Description |
---|---|---|
ApiCep.php | Class | Class source |
BaseCepProvider.php | Class | Class source |
BrasilApiV1.php | Class | Class source |
BrasilApiV2.php | Class | Class source |
CepLa.php | Class | Class source |
OpenCep.php | Class | Class source |
Pagarme.php | Class | Class source |
Postomon.php | Class | Class source |
ViaCep.php | Class | Class source |
Files | / | src | / | Controllers |
File | Role | Description |
---|---|---|
ConsultCepController.php | Class | Class source |
Controller.php | Class | Class source |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
Feature (10 files) | ||||
Helpers (1 file) | ||||
Unit (5 files) | ||||
TestCase.php | Class | Class source |
Files | / | tests | / | Feature |
File | Role | Description |
---|---|---|
ApiCepProviderTest.php | Class | Class source |
BrasilApiV1ProviderTest.php | Class | Class source |
BrasilApiV2ProviderTest.php | Class | Class source |
CepFacadeTest.php | Class | Class source |
CepLaProviderTest.php | Class | Class source |
ConsultCepApiRouteTest.php | Class | Class source |
OpenCepProviderTest.php | Class | Class source |
PagarmeCepProviderTest.php | Class | Class source |
PostomonCepProviderTest.php | Class | Class source |
ViaCepProviderTest.php | Class | Class source |
Files | / | tests | / | Unit |
File | Role | Description |
---|---|---|
CepEntityTest.php | Class | Class source |
CepNotFoundExceptionTest.php | Class | Class source |
ConfigTest.php | Class | Class source |
MaskHelperTest.php | Class | Class source |
StatesEnumTest.php | Class | Class source |
Install with Composer - Download all files: laravel-brazilian-ce.tar.gz laravel-brazilian-ce.zip NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
|