PHP code example of dynamikaweb / yii2-brasilapi

1. Go to this page and download the library: Download dynamikaweb/yii2-brasilapi 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/ */

    

dynamikaweb / yii2-brasilapi example snippets


    'components' =>[
        'urlManager' => [
            ...
            'rules' => [
                'brasilapi/<route:[a-zA-Z0-9\/-]+>' => 'brasilapi/request/index',
            ]
        ]
    ],
    ...
    'modules' => [
        'brasilapi' =>  [
            'class' => '\dynamikaweb\brasilapi\Module'
        ],
    ]

use dynamikaweb\brasilapi\widgets\CepWidget;
...
echo $form->field($model, 'cep')->widget(CepWidget::className(), [
    //'template' => CepWidget::TEMPLATE_MATERIALIZE,
    'fields' => [
        'street' => 'id-model-street',
        'neighborhood' => 'id-model-neighborhood',
        'city' => 'id-model-city',
        'state' => 'id-model-state',
    ]
]);

echo CepWidget::widget([
    'fields' => [
        'street' => 'id-model-street',
        'neighborhood' => 'id-model-neighborhood',
        'city' => 'id-model-city',
        'state' => 'id-model-state',
    ]
]);