PHPackages                             kayacekovic/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. kayacekovic/phone-number

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

kayacekovic/phone-number
========================

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

v1.2.2(4y ago)02.5kMITPHPPHP &gt;=7.3.0

Since Sep 26Pushed 4y agoCompare

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

READMEChangelog (3)Dependencies (2)Versions (17)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

```

### Version Note

[](#version-note)

With the introduction of the new [Placeholder Method](https://nova.laravel.com/releases/3.9.0), this package now requires Nova version 3.9 or above.

If you are using Laravel Nova &lt; 3.9, **please use the following command to install this package:**

```
composer require dniccum/phone-number:~1.0.0

```

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)

License
-------

[](#license)

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

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 73.8% 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 ~76 days

Recently: every ~85 days

Total

16

Last Release

1630d ago

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

v1.1.0PHP &gt;=7.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a728b47a1ee9fd11f949888a6de60971bbeaf3057d022eab6a6e50491089b4b?d=identicon)[kayacekovic](/maintainers/kayacekovic)

---

Top Contributors

[![dniccum](https://avatars.githubusercontent.com/u/2816415?v=4)](https://github.com/dniccum "dniccum (31 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![kayacekovic](https://avatars.githubusercontent.com/u/32109756?v=4)](https://github.com/kayacekovic "kayacekovic (3 commits)")[![batFormat](https://avatars.githubusercontent.com/u/13119245?v=4)](https://github.com/batFormat "batFormat (1 commits)")[![bradenkeith](https://avatars.githubusercontent.com/u/219298?v=4)](https://github.com/bradenkeith "bradenkeith (1 commits)")[![lintaba](https://avatars.githubusercontent.com/u/375078?v=4)](https://github.com/lintaba "lintaba (1 commits)")

---

Tags

laravelphonefieldnumbernova

### Embed Badge

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

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

###  Alternatives

[dniccum/phone-number

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

71432.7k](/packages/dniccum-phone-number)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)[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)[stepanenko3/nova-json

Nova json field to spread a json column throughout multiple fields.

42249.7k](/packages/stepanenko3-nova-json)[optimistdigital/nova-notes-field

This Laravel Nova package adds a notes field to Nova's arsenal of fields.

52139.5k](/packages/optimistdigital-nova-notes-field)

PHPackages © 2026

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