PHPackages                             atua/filament-fields - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. atua/filament-fields

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

atua/filament-fields
====================

Brazilian pt-BR form fields.

074PHP

Since Feb 21Pushed 1y agoCompare

[ Source](https://github.com/atua/filament-fields)[ Packagist](https://packagist.org/packages/atua/filament-fields)[ RSS](/packages/atua-filament-fields/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Atua Filament Fields
====================

[](#atua-filament-fields)

This package is a fork of the [filament-ptbr-form-fields](https://github.com/leandrocfe/filament-ptbr-form-fields) project by [Leandrocfe](https://github.com/leandrocfe), where we made adjustments and created new field formats as well.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require atua/filament-fields:dev-master
```

Usage
-----

[](#usage)

### DateTimePicker

[](#datetimepicker)

```
use Atua\FilamentFields\DateTimePicker;

DateTimePicker::make('dt_inicio')
```

We can use this field to create a date or date + time field, to do this just use the format function:

```
use Atua\FilamentFields\DateTimePicker;
use Atua\FilamentFields\Enums\DateTimeFormat;

DateTimePicker::make('dt_inicio')
    ->format(DateTimeFormat::DDMMYY)

# the allowed formats are specified in the Atua\FilamentFields\Enums\DateTimeForma enum
```

You can also add the option to select the current date/time using the useActualDateTime function:

```
use Atua\FilamentFields\DateTimePicker;
use Atua\FilamentFields\Enums\DateTimeFormat;

DateTimePicker::make('dt_inicio')
    ->useActualDateTime()
```

### CPF / CNPJ

[](#cpf--cnpj)

To create a dynamic input that accepts either CPF or CNPJ, use:

```
use Atua\FilamentFields\Document;
//CPF or CNPJ
Document::make('cpf_or_cnpj')
    ->dynamic()
```

If you want to create an input that only accepts CPF or only accepts CNPJ, use:

```
//CPF
Document::make('cpf')
    ->cpf()
```

```
//CNPJ
Document::make('cnpj')
    ->cnpj()
```

If you want to use a custom mask for the input, use the cpf() or cnpj() method with a string argument representing the desired mask:

```
Document::make('cpf')
    ->cpf('999999999-99')
```

```
Document::make('cnpj')
    ->cnpj('99999999/9999-99')
```

### Validation

[](#validation)

`Document` uses [LaravelLegends/pt-br-validator](https://github.com/LaravelLegends/pt-br-validator) to validate Brazilian Portuguese fields by default - `cpf_ou_cnpj` | `cpf` | `cnpj`

You can disable validation using the `validation(false)` method:

```
Document::make('cpf_or_cnpj')
    ->validation(false)
    ->dynamic()
```

```
Document::make('cpf')
    ->validation(false)
    ->cpf()
```

### Phone number

[](#phone-number)

To create a dynamic input that formats phone numbers with DDD, use:

```
use Atua\FilamentFields\PhoneNumber;
PhoneNumber::make('phone_number')
```

If you want to use a custom phone number format, use the `mask() method with a string argument representing the desired format:

```
PhoneNumber::make('phone_number')
    ->mask('(99) 99999-9999')
```

```
PhoneNumber::make('phone_number')
    ->mask('+99 (99) 99999-9999')
```

### Money

[](#money)

To create a money input field, use the following syntax:

```
use Atua\FilamentFields\Money;
Money::make('price')
    ->default('100,00')

#output: 100.00
```

This is suitable for use with `decimal` or `float` data types.

#### Using Integer Values

[](#using-integer-values)

If you prefer to work with integer values, you can format the money input using the `intFormat()` method:

```
use Atua\FilamentFields\Money;
Money::make('price')
    ->default(10000)
    ->intFormat()

#output: 10000
```

#### Getting the Raw State

[](#getting-the-raw-state)

To retrieve the raw state of the field, you can use the `dehydratedMask() method:

```
use Atua\FilamentFields\Money;
Money::make('price')
    ->default('100,00')
    ->dehydrateMask()

#output: 100,00
```

If you need to remove the prefix from the money input, simply pass null to the `prefix()` method:

```
Money::make('price')
    ->prefix(null)
```

#### Currency Formatting

[](#currency-formatting)

This package leverages the `archtechx/money` package under the hood. By default, it uses the `BRL` (Brazilian Real) format for currency values.

If you want to switch to the `USD` (United States Dollar) format, you can do so with the following code:

```
use Atua\FilamentFields\Currencies\USD;

Money::make('price')
    ->currency(USD::class)
    ->prefix('$')
```

You can also define custom currencies to suit your specific needs:

```
/*
 * app/Currencies/EUR.php
 */

declare(strict_types=1);

namespace App\Currencies;

use ArchTech\Money\Currency;

class EUR extends Currency
{
    /*
     * Code of the currency.
     */
    public string $code = 'EUR';

    /*
     * Name of the currency.
     */
    public string $name = 'Euro';

    /*
     * Rate of this currency relative to the default currency.
     */
    public float $rate = 1.0;

    /*
     * Number of decimals used in money calculations.
     */
    public int $mathDecimals = 2;

    /*
     * Number of decimals used in the formatted value
     */
    public int $displayDecimals = 2;

    /*
     * How many decimals of the currency's values should get rounded
     */
    public int $rounding = 2;

    /*
     * Prefix placed at the beginning of the formatted value.
    */
    public string $prefix = '€';

    /*
     * The language code.
     */
    public string $locale = 'pt';

    /*
     * The character used to separate the decimal values.
     */
    public string $decimalSeparator = '.';

    /*
     * The character used to separate groups of thousands
     */
    public string $thousandsSeparator = ',';
}
```

```
use App\Currencies\EUR;

Money::make('price')
->currency(EUR::class)
->prefix('€')
```

### Address

[](#address)

To integrate with the ViaCep API for CEP validation and address autofill, use:

```
use Atua\FilamentFields\Cep;
use Filament\Forms\Components\TextInput;
Cep::make('postal_code')
    ->viaCep(
        mode: 'suffix', // Determines whether the action should be appended to (suffix) or prepended to (prefix) the cep field, or not included at all (none).
        errorMessage: 'CEP inválido.', // Error message to display if the CEP is invalid.

        /**
         * Other form fields that can be filled by ViaCep.
         * The key is the name of the Filament input, and the value is the ViaCep attribute that corresponds to it.
         * More information: https://viacep.com.br/
         */
        setFields: [
            'street' => 'logradouro',
            'number' => 'numero',
            'complement' => 'complemento',
            'district' => 'bairro',
            'city' => 'localidade',
            'state' => 'uf'
        ]
    ),

TextInput::make('street'),
TextInput::make('number'),
TextInput::make('complement'),
TextInput::make('district'),
TextInput::make('city'),
TextInput::make('state'),
```

The mode parameter specifies whether the search action should be appended to or prepended to the CEP field, using the values suffix or prefix. Alternatively, you can use the none value with the `->live(onBlur: true)` method to indicate that the other address fields will be automatically filled only when the CEP field loses focus.

### Relatorio

[](#relatorio)

To create a form filter for reports, you can use a custom Artisan command:

```
php artisan make:report ReportName

```

The script will prompt you to enter the `name` of the new filter and will generate a new class in `app\Filament\Pages\Reports\ReportName`. Simply follow the script's instructions, and the filter will be easily accessible without any additional configuration. You will only need to focus on implementing the form fields and any extra logic specific to your report.

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity15

Early-stage or recently created project

 Bus Factor1

Top contributor holds 56.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a15bc3f010951df9bac2a27cb8ac0d435fc672ada788685625b405f93bf195a1?d=identicon)[atua](/maintainers/atua)

---

Top Contributors

[![leandrocfe](https://avatars.githubusercontent.com/u/3833889?v=4)](https://github.com/leandrocfe "leandrocfe (44 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (8 commits)")[![rmsramos](https://avatars.githubusercontent.com/u/5170473?v=4)](https://github.com/rmsramos "rmsramos (8 commits)")[![viniciusspode](https://avatars.githubusercontent.com/u/168739298?v=4)](https://github.com/viniciusspode "viniciusspode (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![patriciomartinns](https://avatars.githubusercontent.com/u/20000058?v=4)](https://github.com/patriciomartinns "patriciomartinns (3 commits)")[![danielcei](https://avatars.githubusercontent.com/u/19355609?v=4)](https://github.com/danielcei "danielcei (2 commits)")

### Embed Badge

![Health badge](/badges/atua-filament-fields/health.svg)

```
[![Health](https://phpackages.com/badges/atua-filament-fields/health.svg)](https://phpackages.com/packages/atua-filament-fields)
```

###  Alternatives

[robinherbots/jquery.inputmask

Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.

6.5k276.6k4](/packages/robinherbots-jqueryinputmask)[webman/captcha

Captcha generator

1484.2k25](/packages/webman-captcha)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
