1. Go to this page and download the library: Download rmsramos/postal-code 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/ */
rmsramos / postal-code example snippets
use Filament\Forms\Components\TextInput;
use Rmsramos\PostalCode\Components\PostalCode;
public static function form(Form $form): Form
{
return $form
->schema([
PostalCode::make('postal_code')
->viaCep(
errorMessage: 'CEP inválido.', // Custom message to display if the CEP is invalid.
setFields: [
'street' => 'logradouro',
'number' => 'numero',
'complement' => 'complemento',
'district' => 'bairro',
'city' => 'localidade',
'state' => 'uf'
]
),
TextInput::make('street'),
TextInput::make('number')
->extraAlpineAttributes([
'x-on:cep.window' => "\$el.focus()",
]),,
TextInput::make('complement'),
TextInput::make('district'),
TextInput::make('city'),
TextInput::make('state'),
])
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.