Download the PHP package jeffersongoncalves/filament-cep-field without Composer
On this page you can find all versions of the php package jeffersongoncalves/filament-cep-field. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeffersongoncalves/filament-cep-field
More information about jeffersongoncalves/filament-cep-field
Files in jeffersongoncalves/filament-cep-field
Package filament-cep-field
Short Description The Filament CEP Field is a custom input component designed specifically for Brazilian postal codes (CEP - Código de Endereçamento Postal). This component extends Filament's form capabilities by providing a specialized input field that handles CEP formatting, validation, and automatic address lookup.
License MIT
Homepage https://github.com/jeffersongoncalves/filament-cep-field
Informations about the package filament-cep-field
Filament CEP Field
The Filament CEP Field is a custom input component designed specifically for Brazilian postal codes (CEP - Código de Endereçamento Postal). This component extends Filament's form capabilities by providing a specialized input field that handles CEP formatting, validation, and automatic address lookup.
What it does:
- CEP Formatting: Automatically applies the standard Brazilian CEP mask (99999-999) as users type
- Address Lookup: Integrates with CEP APIs to automatically fetch and populate address information
- Form Integration: Seamlessly integrates with Filament forms and follows Filament's design patterns
- Validation: Provides built-in validation for CEP format and existence
- Customization: Offers extensive customization options for labels, error messages, and field mappings
This component is perfect for Brazilian applications that need to collect address information efficiently and accurately.
Features
- 🚀 Multiple API providers (BrasilAPI, ViaCEP, AwesomeAPI)
- 💾 Automatic database caching with Laravel Model Caching
- 🔄 Automatic cache invalidation
- 🎯 CEP validation and formatting
- ⚡ Queue-based cache management
- 🇧🇷 Complete Brazilian states support
Installation
You can install the package via composer:
Publish and run the migration file:
Usage
Once installed, you can use the CepInput component in your Filament forms. The component automatically applies a CEP mask (99999-999), validates the input, and can automatically populate address fields when a valid CEP is found.
Available Methods
setMode(string $mode)
Sets the position of the search action button.
'suffix'
(default): Places the button after the input field'prefix'
: Places the button before the input field
setActionLabel(string $label)
Customizes the label text for the search action button.
- Default:
'Buscar CEP'
setActionLabelHidden(bool $hidden)
Controls whether the action button label is visible.
true
: Shows only the magnifying glass iconfalse
(default): Shows both icon and label
setErrorMessage(string $message)
Sets a custom error message when CEP lookup fails.
- Default:
'CEP inválido.'
Field Mapping Methods
These methods allow you to specify which form fields should be automatically populated with the address information:
setStreetField(string $fieldName)
- Default:'street'
setNeighborhoodField(string $fieldName)
- Default:'neighborhood'
setCityField(string $fieldName)
- Default:'city'
setStateField(string $fieldName)
- Default:'state'
Features
- Automatic Masking: Applies the Brazilian CEP format (99999-999)
- Real-time Validation: Validates CEP format and existence
- Automatic Address Population: Fills related address fields when a valid CEP is found
- Customizable Search Button: Can be positioned as prefix or suffix with custom labels
- Error Handling: Provides validation errors for invalid CEPs
Usage Examples
Simple CEP Input
CEP with Custom Field Mapping
CEP with Prefix Button and Custom Labels
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Jèfferson Gonçalves
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-cep-field with dependencies
filament/filament Version ^3.0
jeffersongoncalves/laravel-cep Version ^1.0
spatie/laravel-package-tools Version ^1.14.0