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

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

greg0x46/masked-field
=====================

A Laravel Nova field.

v1.2.0(1y ago)973.6k↑29.1%6MITVuePHP ^7.3|^8.0

Since Nov 8Pushed 1y ago2 watchersCompare

[ Source](https://github.com/greg0x46/laravel-nova-masked-field)[ Packagist](https://packagist.org/packages/greg0x46/masked-field)[ RSS](/packages/greg0x46-masked-field/feed)WikiDiscussions main Synced 1mo ago

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

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

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

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

[](#installation)

```
composer require greg0x46/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 Greg0x46\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 Greg0x46\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('(##) ####-####');
            })
    ];
}
```

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

41

—

FairBetter than 89% of packages

Maintenance43

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% 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 ~206 days

Total

5

Last Release

461d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6f943fb2a729fa336a3d0a0b4d0509c0a31d18ab3f2042aa282bc692dd07e7bb?d=identicon)[greg0x46](/maintainers/greg0x46)

---

Top Contributors

[![greg0x46](https://avatars.githubusercontent.com/u/16712150?v=4)](https://github.com/greg0x46 "greg0x46 (8 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)")

---

Tags

laravelnovamask

### Embed Badge

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

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

###  Alternatives

[optimistdigital/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2872.1M6](/packages/optimistdigital-nova-sortable)[outl1ne/nova-sortable

This Laravel Nova package allows you to reorder models in a Nova resource's index view using drag &amp; drop.

2861.8M9](/packages/outl1ne-nova-sortable)[optimistdigital/nova-multiselect-field

A multiple select field for Laravel Nova.

3403.5M7](/packages/optimistdigital-nova-multiselect-field)[digital-creative/conditional-container

Provides an easy way to conditionally show and hide fields in your Nova resources.

116593.8k4](/packages/digital-creative-conditional-container)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)

PHPackages © 2026

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