rafaellaurindo/laravel-brasilapi

A Laravel package that provides a simple way to use the Brasil API endpoints
36,594 6
Install
composer require rafaellaurindo/laravel-brasilapi
Latest Version:v1.0.4
PHP:^8.0
License:MIT
Last Updated:Apr 26, 2025
Links: GitHub  ·  Packagist
Maintainer: rafaellaurindo

Laravel Brasil API 🇧🇷

Latest Stable Version Tests Code Style License Total Downloads

Laravel Brasil API is a simple and elegant package to easily consume Brasil API endpoints within your Laravel applications.


📑 Table of Contents


📦 Installation

Requirements:
This package supports Laravel 8.0 and above.

Install the package via Composer:

composer require rafaellaurindo/laravel-brasilapi

Optionally, you can publish the config file:

php artisan vendor:publish --provider="RafaelLaurindo\BrasilApi\BrasilApiServiceProvider" --tag="config"

🚀 Usage

You can access the package using Dependency Injection, Facade, or Helper.

1. Using Dependency Injection

use RafaelLaurindo\BrasilApi\BrasilApi;

class ExampleController
{
    public function searchZipCode(BrasilApi $brasilApi)
    {
        return response()->json($brasilApi->cep('01431000'));
    }
}

2. Using Facade

use BrasilApi;

BrasilApi::cep('01431000');

3. Using Helper

brasilApi()->getBank(77);

📚 Examples

Make sure you import the Facade when using the examples:

use BrasilApi;

🔎 Search address by zip code

BrasilApi::cep('01431000');

🏦 List Brazilian banks

BrasilApi::getBanks();

🏛️ Get a bank by its code

BrasilApi::getBank(77);

🏢 Find company information by CNPJ

BrasilApi::findCnpj('19131243000197');

✅ Running Tests

To run the package tests, simply execute:

composer test

📋 Changelog

Please refer to the CHANGELOG to learn about updates and changes.


🤝 Contributing

Feel free to read the CONTRIBUTING guide if you want to contribute to this project.


🔐 Security Vulnerabilities

If you discover a security vulnerability, please review our Security Policy for how to report it.


👨‍💻 Credits


📄 License

This package is open-sourced software licensed under the MIT license.

Related Packages

paulo-hortelan/lara-cep

Pacote Laravel para consulta de CEPs brasileiros com múltiplos provedores, cache...

1,252 1
robersonfaria/validation

Pacote Laravel para validações comuns ao Brasil(pt-BR) tipo: CNPJ,CPF,CEP,CNS

7,559 9
zizaco/cep-consult

This package has the objective to consult the CEP within one or more web APIs th...

2,718 23
canducci/zipcode

ZipCode From Brazil

56,470 45
cagartner/correios-consulta

Package para pesquisa de serviços de busca por cep, calculo de frete e etc, dire...

303,343 156