Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not yet rated by the users | Total: 27 | All time: 11,217 This week: 455![]() |
Version | License | PHP version | Categories | |||
laravel-brazilian-ce 1.0.0 | Custom (specified... | 5 | PHP 5, Searching, Web services, Geogr... |
<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.
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
![]() | laravel-brazilian-ce-2022-12-20.zip 34KB |
![]() | laravel-brazilian-ce-2022-12-20.tar.gz 16KB |
![]() | Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.