PHPackages                             rodrigofs/filament-maskinput - 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. rodrigofs/filament-maskinput

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

rodrigofs/filament-maskinput
============================

Alternative the alpine mask.

v1.0.5(2y ago)98.4k↓13.1%2[1 issues](https://github.com/rodrigofs/filament-maskinput/issues)MITJavaScriptPHP ^8.1CI passing

Since Jan 3Pushed 2y ago1 watchersCompare

[ Source](https://github.com/rodrigofs/filament-maskinput)[ Packagist](https://packagist.org/packages/rodrigofs/filament-maskinput)[ GitHub Sponsors](https://github.com/rodrigofs)[ RSS](/packages/rodrigofs-filament-maskinput/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (5)Dependencies (10)Versions (6)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/82f23ae1628b138dde2095536eab17aeced9824e4497523e2c3039088c4f3411/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f726f647269676f66732f66696c616d656e742d6d61736b696e7075742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rodrigofs/filament-maskinput)[![GitHub Tests Action Status](https://github.com/rodrigofs/filament-maskinput/actions/workflows/run-tests.yml/badge.svg)](https://github.com/rodrigofs/filament-maskinput/actions/workflows/run-tests.yml)[![PHPStan](https://github.com/rodrigofs/filament-maskinput/actions/workflows/phpstan.yml/badge.svg)](https://github.com/rodrigofs/filament-maskinput/actions/workflows/phpstan.yml)[![GitHub Code Style Action Status](https://github.com/rodrigofs/filament-maskinput/actions/workflows/fix-php-code-styling.yml/badge.svg)](https://github.com/rodrigofs/filament-maskinput/actions/workflows/fix-php-code-styling.yml)[![Total Downloads](https://camo.githubusercontent.com/7c2284854535c9a3d2905314a316e91972c2ccced6f79b77d6372da183d6d583/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f726f647269676f66732f66696c616d656e742d6d61736b696e7075742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rodrigofs/filament-maskinput)

Motivation for Creating the Filament Mask Input Package
=======================================================

[](#motivation-for-creating-the-filament-mask-input-package)

The Problem:
------------

[](#the-problem)

While working with data input masks in web applications, I encountered a specific challenge related to the Firefox browser. The issue was that the implemented masks did not function as expected in this browser, leading to inconsistencies and problems in the user experience.

Furthermore, when considering the use of Alpine.js's native x-mask as an alternative solution, I encountered another hurdle. There seemed to be an issue in the interaction between Alpine.js and Livewire, particularly in how the state was updated. This behavior resulted in the unexpected removal of input masks, affecting the usability and functionality of the application.

The Solution:
-------------

[](#the-solution)

Faced with these challenges, I decided to create the filament-maskinput package. It is designed to implement input masks efficiently, overcoming the issues found with Firefox and the Alpine.js-Livewire interaction. This package ensures browser compatibility and maintains input masks reliably during Livewire's lifecycle.

Filament Mask Input Package
===========================

[](#filament-mask-input-package)

Overview
--------

[](#overview)

The `filament-maskinput` package enhances FilamentPHP applications by adding masked input functionalities. It allows for the creation of inputs with various masking patterns, including monetary, dynamic, and fixed patterns.

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

[](#installation)

Install the package via composer:

```
composer require rodrigofs/filament-maskinput
```

Configuration
-------------

[](#configuration)

You can configure the **filament-maskinput** package through the **config/filament-maskinput.php** file, setting default values for parameters like **allowNegative**, **decimalPrecision**, **thousandsSeparator** and **decimalSeparator**.

#### Optionally, you can publish the config using

[](#optionally-you-can-publish-the-config-using)

```
php artisan vendor:publish --tag="config"
```

Usage
-----

[](#usage)

### MaskInput Component

[](#maskinput-component)

**MaskInput** is an extension of **TextInput** in FilamentPHP, designed to create input fields with custom masking patterns.

### Methods

[](#methods)

- **money**

    - **Description**: Configures the input field for monetary values.
    - **Parameters**:
        - `$decimalPrecision` (int|null): Decimal precision.
        - `$decimalSeparator` (string|null): Decimal separator.
        - `$thousandsSeparator` (string|null): Thousands delimiter.
        - `$allowNegative` (bool|null): Allow negative.
- **mask**

    - **Description**: Sets the mask pattern for the input.
    - **Parameters**:
        - `$mask` (string | Closure | RawJs | null): The mask pattern or function.
- **maxLength**

    - **Description**: For dynamic masks, `maxLength` acts as a trigger to switch between mask patterns. It's essential when using dynamic masks.
    - **Parameters**:
        - `$length` (int | Closure): Maximum length for the input.

Examples
--------

[](#examples)

#### Money Input

[](#money-input)

```
MaskInput::make('money')
->money();

MaskInput::make('money')
->money(decimalPrecision: 3, allowNegative: true);

output: "-1.234,560"
```

#### Dynamic Input

[](#dynamic-input)

```
MaskInput::make('dynamic')
->mask(RawJs::make("['999.999.999-99', '99.999.999/9999-99']"))
->stripCharacters(['.','-', '/'])
->maxLength(14) // Acts as a trigger for mask switching

output: "123.456.789-01" or "12.345.678/9012-34"
```

#### Pattern Input

[](#pattern-input)

```
MaskInput::make('pattern')
->mask('99999-999')
->stripCharacters(['-'])

output: "12345-678"
```

```
MaskInput::make('pattern')
->mask('SS.SS.SSSSS.S.S.SSSSSS')
->stripCharacters(['.'])

output: "9B.GR.D08X0.4.G.117974"
```

```
MaskInput::make('pattern')
->mask('AAA-9999')
->stripCharacters(['-'])

output: "ABC-1234"
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rodrigo Fernandes](https://github.com/rodrigofs)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 92.9% 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.

###  Release Activity

Cadence

Every ~17 days

Total

5

Last Release

844d ago

### Community

Maintainers

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

---

Top Contributors

[![rodrigofs](https://avatars.githubusercontent.com/u/2329113?v=4)](https://github.com/rodrigofs "rodrigofs (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rodrigofs-filament-maskinput/health.svg)

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

###  Alternatives

[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[ysfkaya/filament-phone-input

A phone input component for Laravel Filament

3161.3M25](/packages/ysfkaya-filament-phone-input)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

94135.4k5](/packages/marcelweidum-filament-expiration-notice)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-two-factor-authentication

Filament Two Factor Authentication: Google 2FA + Passkey Authentication

84215.9k9](/packages/stephenjude-filament-two-factor-authentication)

PHPackages © 2026

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