Goldbach Algorithms Address Info Getter (fondly nicknamed AIG) is a PHP library developed for Symfony to collect address information.
Use the composer to install:
composer require goldbach-algorithms/aig
Create an AIG instance and look for the address indicating or not the source of access.
# Add use AIG
use GoldbachAlgorithms\AIG\AIG;
# create a new AIG
$aig = new AIG();
# get address by CEP
$aig->getAddressByCep('89566410');
# get address by cep using a specific source
$aig->getAddressByCep('89304258', AIG::SOURCE_CORREIOS);
$aig->getAddressByCep('89304258', AIG::SOURCE_VIACEP);
Look at an example of a JSON return displaying the source of the information.
{
"zipCode": "89304258",
"street": "Rua Pioneiro Arlindo Goldbach",
"complement": "",
"neighborhood": "Vila Nova",
"city": "Mafra",
"state": "SC",
"source": "Correios"
}
Copyright © 2021 Goldbach Algorithms