rafaellaurindo / laravel-brasilapi
A Laravel package that provides a simple way to use the Brasil API endpoints
Fund package maintenance!
rafaellaurindo
Installs: 10 931
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 2
Open Issues: 0
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.4
- laravel/framework: ^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- brianium/paratest: ^6.3
- friendsofphp/php-cs-fixer: ^3.2
- nunomaduro/collision: ^5.10|^6.0|^7.0
- orchestra/testbench: ^6.23
- phpunit/phpunit: ^9.5|^10.0
README
A Laravel package that provides a simple way to use the Brasil API endpoints.
Installation
You can install the package via composer:
composer require rafaellaurindo/laravel-brasilapi
You can publish the config file with:
php artisan vendor:publish --provider="RafaelLaurindo\BrasilApi\BrasilApiServiceProvider" --tag="config"
Usage
You can use the methods from Dependency Injection
, Facade
or helper
.
Using from Dependency Injection:
use RafaelLaurindo\BrasilApi\BrasilApi; class ExampleController { public function searchZipCode(BrasilApi $brasilApi) { return response()->json($brasilApi->cep('01431000')); } }
Using from Facade:
use BrasilApi; BrasilApi::cep('01431000');
Using from helper:
brasilApi()->getBank(77);
After you've installed the package. All the following examples use the facade. Don't forget to import it at the top of your file.
use BrasilApi;
Searching address by zip code:
BrasilApi::cep('01431000');
Get Brazilian banks list:
BrasilApi::getBanks();
Get a bank from code:
BrasilApi::getBank(77);
Find company information using the CNPJ:
BrasilApi::findCnpj('19131243000197');
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.