laravel-brasilapi maintained by rafaellaurindo
Description
A Laravel package that provides a simple way to use the Brasil API endpoints
Author
Last update
2025/04/26 20:27
(dev-main)
License
Downloads
26 474
Tags
Laravel Brasil API 🇧🇷
Laravel Brasil API is a simple and elegant package to easily consume Brasil API endpoints within your Laravel applications.
📑 Table of Contents
- Installation
- Usage
- Examples
- Running Tests
- Changelog
- Contributing
- Security Vulnerabilities
- Credits
- License
📦 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.