PHP code example of wbraganca / yii2-correios

1. Go to this page and download the library: Download wbraganca/yii2-correios library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wbraganca / yii2-correios example snippets




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.'
);
*/


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