Integration with Correios Webservices.
- PHP 5.4 or above
- SOAP extension
- Open your project directory;
- Run
composer require mero/correios
to addMero Correios
in your project vendor.
Method | Description | Parameters | Return | Exceptions |
---|---|---|---|---|
findAddressByZipCode | Find address informations using the zip code. | $zipCode | Mero\Correios\Model\Address | AddressNotFoundException and InvalidZipCodeException |
Declare an instance of object Mero\Correios\Client
and use the methods
available in the client.
Example:
<?php
$correios = new \Mero\Correios\Client();
$address = $correios->findAddressByZipCode('22640102'); // Return Address object related to '22640-102' zip-code.
echo $address->getAddress(); // Return the address 'Avenida das Américas'
echo $address->getNeighborhood(); // Return the neighborhood 'Barra da Tijuca'
echo $address->getCity(); // Return the city 'Rio de Janeiro'
echo $address->getState(); // Return the state 'RJ'
echo $address->getZipCode(); // Return the address '22640102'