Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rafaellaurindo/laravel-brasilapi
A Laravel package that provides a simple way to use the Brasil API endpoints.
https://github.com/rafaellaurindo/laravel-brasilapi
banks banks-list brasil brasilapi cep cnpj laravel laravel-framework laravel-package
Last synced: 3 months ago
JSON representation
A Laravel package that provides a simple way to use the Brasil API endpoints.
- Host: GitHub
- URL: https://github.com/rafaellaurindo/laravel-brasilapi
- Owner: rafaellaurindo
- License: mit
- Created: 2021-11-12T02:44:55.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-15T19:14:33.000Z (9 months ago)
- Last Synced: 2024-09-30T10:40:56.429Z (3 months ago)
- Topics: banks, banks-list, brasil, brasilapi, cep, cnpj, laravel, laravel-framework, laravel-package
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Laravel Brasil API
[![Latest Stable Version](http://poser.pugx.org/rafaellaurindo/laravel-brasilapi/v)](https://packagist.org/packages/rafaellaurindo/laravel-brasilapi)
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/rafaellaurindo/laravel-brasilapi/run-tests?label=tests)](https://github.com/rafaellaurindo/laravel-brasilapi/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/rafaellaurindo/laravel-brasilapi/Check%20&%20fix%20styling?label=code%20style)](https://github.com/rafaellaurindo/laravel-brasilapi/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
[![License](https://img.shields.io/github/license/rafaellaurindo/laravel-brasilapi)](https://github.com/rafaellaurindo/laravel-brasilapi/blob/main/LICENSE.md)
[![Total Downloads](https://img.shields.io/packagist/dt/rafaellaurindo/laravel-brasilapi)](https://packagist.org/packages/rafaellaurindo/laravel-brasilapi)A Laravel package that provides a simple way to use the [Brasil API](https://brasilapi.com.br/) endpoints.
## Installation
You can install the package via composer:
```bash
composer require rafaellaurindo/laravel-brasilapi
```You can publish the config file with:
```bash
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:
```php
use RafaelLaurindo\BrasilApi\BrasilApi;class ExampleController
{
public function searchZipCode(BrasilApi $brasilApi)
{
return response()->json($brasilApi->cep('01431000'));
}
}
```Using from Facade:
```php
use BrasilApi;BrasilApi::cep('01431000');
```Using from helper:
```php
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.
```php
use BrasilApi;
```### Searching address by zip code:
```php
BrasilApi::cep('01431000');
```### Get Brazilian banks list:
```php
BrasilApi::getBanks();
```### Get a bank from code:
```php
BrasilApi::getBank(77);
```### Find company information using the CNPJ:
```php
BrasilApi::findCnpj('19131243000197');
```## Testing
```bash
composer test
```## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [Rafael Laurindo](https://github.com/rafaellaurindo)
- [All Contributors](../../contributors)## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.