PHPackages                             dniccum/phone-number - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. dniccum/phone-number

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

dniccum/phone-number
====================

A Laravel Nova phone number field with input masking and validation support.

v3.0.2(1y ago)71432.7k—8.4%18[7 PRs](https://github.com/dniccum/nova-phone-number/pulls)MITPHPPHP ^8.1CI passing

Since Sep 26Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/dniccum/nova-phone-number)[ Packagist](https://packagist.org/packages/dniccum/phone-number)[ GitHub Sponsors](https://github.com/dniccum)[ RSS](/packages/dniccum-phone-number/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (33)Used By (0)

[![Laravel Nova Phone Number Field](https://github.com/dniccum/nova-phone-number/raw/master/screenshots/nova-phone-number-input-social-image.png?raw=true)](https://github.com/dniccum/nova-phone-number/blob/master/screenshots/nova-phone-number-input-social-image.png?raw=true)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cbd52d30f0935fcea5924a7ec4729d4be50907647059296a327ba4866c2d0041/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f70686f6e652d6e756d6265722f762f737461626c653f666f726d61743d666c61742d73717561726526636f6c6f723d23304537464330)](https://packagist.org/packages/dniccum/phone-number)[![License](https://camo.githubusercontent.com/fdf5b7be3ba8cac40a7d70061b0ffca59fb4b688ce719a0b123c8941eccf37c4/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f70686f6e652d6e756d6265722f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/dniccum/phone-number)[![Total Downloads](https://camo.githubusercontent.com/ee4b86502fa1080f46a0afddb8a40883ded5ac9dec28cd9a8ab9c37a02579ff4/68747470733a2f2f706f7365722e707567782e6f72672f646e696363756d2f70686f6e652d6e756d6265722f646f776e6c6f6164733f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/dniccum/phone-number)

A Laravel Nova field to format using a dynamic input mask and additional phone number validation.

**NOTE: This field utilizes [Propaganistas / Laravel-Phone package](https://github.com/Propaganistas/Laravel-Phone) for validation.**

[![Image 1](./screenshots/screenshot-1.png "Phone number input")](./screenshots/screenshot-1.png)

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

[](#installation)

To install this tool, use the installation code below:

```
composer require dniccum/phone-number

```

Code
----

[](#code)

To use the field, add the following code to your Nova resource. As this is a field, all of the default field properties can be applied.

```
use Dniccum\PhoneNumber\PhoneNumber;

PhoneNumber::make('Phone Number')
```

### Options

[](#options)

To support multiple types and formats of phone numbers, this field has multiple methods for input masking and validation that are available.

#### Defaults

[](#defaults)

Method/OptionsDefaultformat**string:** '(###) ###-####'placeholder**string:** '\[Name of Field\]'useMaskPlaceholder**boolean:** falsecountry**string:** 'US'countries**string\[\]:** \['US'\]disableValidation**boolean:** falselinkOnIndex**boolean:** falselinkOnDetail**boolean:** false#### format

[](#format)

```
PhoneNumber::make('Phone Number')
    ->format('###-###-####')
```

**Type:** string

**Default:** (###) ###-####

This is the value that the javascript controlling the input mask will use define it's values; and depending the field's configuration the placeholder text. To indicate numbers, use the hash (#) symbol.

**Note:** Other types of content can be included within this input like an phone extension:

```
PhoneNumber::make('Phone Number')
    ->format('###-###-#### ext ####')
```

However the built-in phone number validation will **FAIL** as this is technically an invalid phone number. To prevent the validation from failing, turn off the phone number validation like so:

```
PhoneNumber::make('Phone Number')
    ->format('###-###-####')
    ->disableValidation()
```

#### placeholder

[](#placeholder)

```
PhoneNumber::make('Phone Number')
    ->placeholder('Personal Home Number')
```

**Type:** string

**Default:** \[Name of the Field\]

If you would like to override the default placeholder supplied by Nova, which is the name of field, user a simple string.

**Note:** If you are telling the input to override the placeholder by using the input's mask with the `useMaskPlaceholder` method, this will not work.

#### useMaskPlaceholder

[](#usemaskplaceholder)

```
PhoneNumber::make('Phone Number')
    ->useMaskPlaceholder()
```

**Type:** boolean

**Default:** false

This will tell the field to replace the input's defined placeholder with the input mask from the `->format()` method.

#### country

[](#country)

```
PhoneNumber::make('Phone Number')
    ->country('CA')
```

**Type:** string

**Default:** US

This tells the field what type of phone number validation to use. To define a type of validation, define a [ISO 3166-1 alpha-2 compliant](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) country code.

You can only define one country here. If you would like to define more than one, please see the `->countries()` method.

**NOTE: This field utilizes [Propaganistas / Laravel-Phone package](https://github.com/Propaganistas/Laravel-Phone) for validation.**

#### countries

[](#countries)

```
PhoneNumber::make('Phone Number')
    ->countries(['US', 'CA'])
```

**Type:** string\[\]

**Default:** US

If you would like to define more than one country to validate against, define string-based array of [ISO 3166-1 alpha-2 compliant](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements) country codes.

**NOTE: This field utilizes [Propaganistas / Laravel-Phone package](https://github.com/Propaganistas/Laravel-Phone) for validation.**

#### linkOnIndex

[](#linkonindex)

```
PhoneNumber::make('Phone Number')
    ->linkOnIndex()
```

**Type:** boolean

**Default:** false

Render's the phone number as a clickable link on the index view.

#### linkOnDetail

[](#linkondetail)

```
PhoneNumber::make('Phone Number')
    ->linkOnDetail()
```

**Type:** boolean

**Default:** false

Render's the phone number as a clickable link on the detail view.

Credits
-------

[](#credits)

- [Doug Niccum](https://github.com/dniccum)
- [Braden Keith](https://github.com/bradenkeith)
- [lintaba](https://github.com/lintaba)
- [Maxim Kot](https://github.com/batFormat)
- [Shawn Heide](https://github.com/shawnheide)

License
-------

[](#license)

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

###  Health Score

59

—

FairBetter than 99% of packages

Maintenance65

Regular maintenance activity

Popularity51

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 60% 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 ~101 days

Recently: every ~56 days

Total

24

Last Release

447d ago

Major Versions

v1.1.2 → v2.0.02022-05-08

v2.2.3 → v3.0.02024-12-18

PHP version history (6 changes)v1.0.0PHP &gt;=7.1.0

v1.1.0PHP &gt;=7.3.0

v2.0.0PHP ^8.0

v2.3.0PHP ^8.0|^8.2

v2.2.3PHP ^8.0|^8.1|^8.2

v3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/9fe997126bcc6a6026a2f6c335ce125055af46178c82faa24d3087b7d5dc0b44?d=identicon)[dniccum](/maintainers/dniccum)

---

Top Contributors

[![dniccum](https://avatars.githubusercontent.com/u/2816415?v=4)](https://github.com/dniccum "dniccum (90 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (37 commits)")[![RhysLees](https://avatars.githubusercontent.com/u/43909932?v=4)](https://github.com/RhysLees "RhysLees (8 commits)")[![shawnheide](https://avatars.githubusercontent.com/u/7305354?v=4)](https://github.com/shawnheide "shawnheide (7 commits)")[![crynobone](https://avatars.githubusercontent.com/u/172966?v=4)](https://github.com/crynobone "crynobone (4 commits)")[![lintaba](https://avatars.githubusercontent.com/u/375078?v=4)](https://github.com/lintaba "lintaba (1 commits)")[![nikolai-vysotskyi](https://avatars.githubusercontent.com/u/36617970?v=4)](https://github.com/nikolai-vysotskyi "nikolai-vysotskyi (1 commits)")[![bradenkeith](https://avatars.githubusercontent.com/u/219298?v=4)](https://github.com/bradenkeith "bradenkeith (1 commits)")[![batFormat](https://avatars.githubusercontent.com/u/13119245?v=4)](https://github.com/batFormat "batFormat (1 commits)")

---

Tags

fieldlaravelnovaphone-numberlaravelphonefieldnumbernova

### Embed Badge

![Health badge](/badges/dniccum-phone-number/health.svg)

```
[![Health](https://phpackages.com/badges/dniccum-phone-number/health.svg)](https://phpackages.com/packages/dniccum-phone-number)
```

###  Alternatives

[alexwenzel/nova-dependency-container

A Laravel Nova 4 form container for grouping fields that depend on other field values.

461.0M2](/packages/alexwenzel-nova-dependency-container)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[simplesquid/nova-advanced-number-field

A Laravel Nova field which adds additional functionality to the default Number field.

11162.7k1](/packages/simplesquid-nova-advanced-number-field)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

14720.0k](/packages/markwalet-nova-modal-response)[ferdiunal/nova-editable-field

A Laravel Nova package to make fields editable.

104.6k](/packages/ferdiunal-nova-editable-field)

PHPackages © 2026

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