mero/correios

Integration with Correios Webservices

0.1.3 2017-06-04 04:27 UTC

This package is auto-updated.

Last update: 2024-04-17 04:51:18 UTC


README

SensioLabsInsight Build Status Coverage Status Latest Stable Version Total Downloads License

Integration with Correios Webservices.

Requirements

  • PHP 5.4 or above
  • SOAP extension

Instalation with composer

  1. Open your project directory;
  2. Run composer require mero/correios to add Mero Correios in your project vendor.

Client methods

Method Description Parameters Return Exceptions
findAddressByZipCode Find address informations using the zip code. $zipCode Mero\Correios\Model\Address AddressNotFoundException and InvalidZipCodeException

Usage

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'