PHPackages                             mlsolutions/masked-field - 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. mlsolutions/masked-field

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

mlsolutions/masked-field
========================

A Laravel Nova field.

00Vue

Since Jun 9Pushed todayCompare

[ Source](https://github.com/ml-solutions-ltda/laravel-nova-masked-field)[ Packagist](https://packagist.org/packages/mlsolutions/masked-field)[ RSS](/packages/mlsolutions-masked-field/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Laravel Nova Masked Field
=========================

[](#laravel-nova-masked-field)

Docker development
------------------

[](#docker-development)

Build the development container:

```
docker compose build
```

Install PHP and JavaScript dependencies. Run Composer first because the frontend build imports Nova mixins from `vendor/laravel/nova`:

```
docker compose run --rm app composer install
docker compose run --rm app npm install
```

Build or watch the Nova field assets:

```
docker compose run --rm app npm run dev
docker compose run --rm app npm run prod
docker compose run --rm app npm run watch
```

If your host user is not UID/GID `1000`, pass your IDs when building so generated files are writable outside the container:

```
UID=$(id -u) GID=$(id -g) docker compose build
```

This package depends on `laravel/nova`, so `composer install` may require your Nova Composer credentials.

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

[](#installation)

```
composer require mlsolutions/masked-field
```

Basic Usage
-----------

[](#basic-usage)

To use the Laravel Nova Masked Field, follow these steps:

1. Import the MaskedField class in your Nova resource file:

```
use Mlsolutions\MaskedField\MaskedField;
```

2. Add the MaskedField to the fields method of your resource file:

```
public function fields(Request $request)
{
    return [
        MaskedField::make('Phone')
            ->mask('(###) ###-####'),
    ];
}
```

3. Optional - Save Value Without Mask
    If you want to store the raw (unmasked) value in the database, use the `raw()` method:

```
MaskedField::make('Phone')
    ->mask('(###) ###-####')
    ->raw(),
```

[![masked-field-demo](https://user-images.githubusercontent.com/16712150/200448755-d3fcc39b-28b6-4145-bbd0-f2d5c8e23713.png)](https://user-images.githubusercontent.com/16712150/200448755-d3fcc39b-28b6-4145-bbd0-f2d5c8e23713.png)

Usage with dependsOn
--------------------

[](#usage-with-dependson)

You can also use the dependsOn method to set a conditional mask based on the value of another field. Here's an example:

```
use Mlsolutions\MaskedField\MaskedField;

public function fields(Request $request)
{
    return [
        MaskedField::make('Phone', 'phone')
            ->mask('(###) ###-####')
            ->dependsOn(['country'], function (MaskedField $field, NovaRequest $request, FormData $formData) {
                if($formData->country == 'BR')
                    $field->mask('(##) ####-####');
            })
    ];
}
```

On Laravel Nova 5, this field emits value changes through Nova's dependent field flow, so it can both react to `dependsOn` updates and be used as the source field for other dependent fields.

Mask syntax
-----------

[](#mask-syntax)

The Laravel Nova Masked Field uses a mask syntax to define patterns for input formatting. Here are the default tokens available:

```
{
    '#': { pattern: /[0-9]/ },
    'X': { pattern: /[0-9a-zA-Z]/ },
    'S': { pattern: /[a-zA-Z]/ },
    'A': { pattern: /[a-zA-Z]/, uppercase: true },
    'a': { pattern: /[a-zA-Z]/, lowercase: true },
    '!': { escape: true },
    '*': { repeat: true }
}
```

You can refer to the [beholdr/maska](https://github.com/beholdr/maska) repository for more information on the mask syntax.

References
----------

[](#references)

- It is a custom field for [Laravel Nova](https://nova.laravel.com/)
- It uses [beholdr/maska](https://github.com/beholdr/maska)
- It is inpired by [wemersonrv/input-mask](https://novapackages.com/packages/wemersonrv/input-mask)

Notice Regarding Nova License
-----------------------------

[](#notice-regarding-nova-license)

Hey everyone,

My Nova license expired in November 2023 for version [v4.29.2](https://nova.laravel.com/releases/4.29.2), which is the last version I have access to. Currently, I don't have plans to renew it, so unfortunately, I won't be able to assist with issues related to updates or newer Nova features. Feel free to seek alternative support or solutions with other users or maintainers.

Thank you for your understanding.

###  Health Score

21

↑

LowBetter than 18% of packages

Maintenance65

Regular maintenance activity

Popularity0

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/b895f8c44bd74d8ad19241803acb2f5763db593c608314de8ec07700e79796eb?d=identicon)[luissobrinho](/maintainers/luissobrinho)

---

Top Contributors

[![greg0x46](https://avatars.githubusercontent.com/u/16712150?v=4)](https://github.com/greg0x46 "greg0x46 (8 commits)")[![sthefanyyTI](https://avatars.githubusercontent.com/u/179609883?v=4)](https://github.com/sthefanyyTI "sthefanyyTI (5 commits)")[![dalmarcolucas](https://avatars.githubusercontent.com/u/17152587?v=4)](https://github.com/dalmarcolucas "dalmarcolucas (4 commits)")[![fzamperin](https://avatars.githubusercontent.com/u/2280530?v=4)](https://github.com/fzamperin "fzamperin (2 commits)")

### Embed Badge

![Health badge](/badges/mlsolutions-masked-field/health.svg)

```
[![Health](https://phpackages.com/badges/mlsolutions-masked-field/health.svg)](https://phpackages.com/packages/mlsolutions-masked-field)
```

###  Alternatives

[a21ns1g4ts/filament-short-url

This is my package filament-short-url

274.0k](/packages/a21ns1g4ts-filament-short-url)

PHPackages © 2026

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