rafaellaurindo / laravel-brasilapi
A Laravel package that provides a simple way to use the Brasil API endpoints
Fund package maintenance!
rafaellaurindo
Installs: 12 133
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 3
Open Issues: 0
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.4
- laravel/framework: ^8.0|^9.0|^10.0|^11.0|^12.0
Requires (Dev)
- brianium/paratest: ^6.3|^7.0|^7.5
- friendsofphp/php-cs-fixer: ^3.2
- nunomaduro/collision: ^5.10|^6.0|^7.0
- orchestra/testbench: ^6.23|^7.0|^8.0
- phpunit/phpunit: ^9.5|^10.0|^11.5.3|^12.0.1
This package is auto-updated.
Last update: 2025-04-26 18:27:55 UTC
README
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.