corviz/brasilapi-php
最新稳定版本:v1.1.1
Composer 安装命令:
composer require corviz/brasilapi-php
包简介
A PHP SDK for BrasilAPI
README 文档
README
A PHP SDK for BrasilAPI project (PHP 8.1+)
Install with composer
composer require corviz/brasilapi-php
How to use
- Every api segment (or sub-path) is represented by a class in this SDK. Eg:
/banks/->BanksApi/cep/->CepApi/cnpj/->CnpjApi- And so on...
- Each api response is stored into a data transfer object (
BankData,CnpjData, etc...) - Every unsuccessful request will throw an
GuzzleException - All indexes have the same name as documented in the official api docs.
- Indexes that are composed by two or more words, are formatted as lowerSnakeCase
Environment variables
BRASILAPI_TIMEOUT - maximum request time in seconds
BRASILAPI_PROXY - Proxy configuration for guzzle (ip)
Usage examples
Example 1. Listing all banks:
use Corviz\BrasilAPI\BankApi; $banks = BankApi::all(); foreach ($banks as $bank) { echo $bank->code, ' - ', $bank->name; }
Example 2. Show address data by CEP (ZIP code)
use Corviz\BrasilAPI\CepApi; $address = CepApi::get('13087901'); echo $address->street; //Avenida Guilherme Campos echo $address->neighborhood; //Jardim Santa Genebra echo $address->city; //Campinas //and so on...
统计信息
- 总下载量: 42
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-22