Skip to content

wbraganca/yii2-correios

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yii2-correios

Latest Version Software License Total Downloads

Install

Via Composer

$ composer require wbraganca/yii2-correios

or add

"wbraganca/yii2-correios": "dev-master"

to the require section of your composer.json file.

Usage

###Raw search.

<?php

use wbraganca\correios\AddressSearchByCep;

$obj = new AddressSearchByCep();
$result = $obj->search('22021-001');
/* OUTPUT
array(
    'location' => 'Avenida Atlântica - de 1662 a 2172 - lado pa'
    'district' => 'Copacabana'
    'city' => 'Rio de Janeiro'
    'state' => 'RJ'
    'cep' => '22021-001'
    'result' => 1
    'result_text' => 'Address found.'
);
*/

###On your controller.

public function actions()
{
    return [
        'searchAddress' => 'wbraganca\correios\CepAction'
    ];
}

http://example.com/index.php?r=your-controller/searchAddress&cep=22021-001

About

Locates an address in Brazil by postal code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages