All Projects → dniccum → nova-phone-number

dniccum / nova-phone-number

Licence: MIT license
A Laravel Nova field to format and validate phone numbers.

Programming Languages

PHP
23972 projects - #3 most used programming language
Vue
7211 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to nova-phone-number

nova-froala-field
A Laravel Nova Froala WYSIWYG Editor Field.
Stars: ✭ 110 (+83.33%)
Mutual labels:  nova, field
nova-opening-hours-field
Laravel Nova custom field for https://github.com/spatie/opening-hours
Stars: ✭ 33 (-45%)
Mutual labels:  nova, field
Stringformatter
Simple Text Formetter (Credit Card Number, Phone Number, Serial Number etc.) Can be used in all text inputs according to the format pattern. If desired, large minor character restrictions can be made in the format pattern.
Stars: ✭ 231 (+285%)
Mutual labels:  phone-number
PhoneVerificationController
A nicer UI for FireBase phone authentication.
Stars: ✭ 30 (-50%)
Mutual labels:  phone-number
rust-phonenumber
Library for parsing, formatting and validating international phone numbers.
Stars: ✭ 99 (+65%)
Mutual labels:  phone-number
react-plough
A library to help tend your react form fields
Stars: ✭ 31 (-48.33%)
Mutual labels:  field
django-isbn-field
Django model field to store and validate ISBN numbers.
Stars: ✭ 21 (-65%)
Mutual labels:  field
Phonia
Phonia Toolkit is one of the most advanced toolkits to scan phone numbers using only free resources. The goal is to first gather standard information such as country, area, carrier and line type on any international phone numbers with a very good accuracy.
Stars: ✭ 221 (+268.33%)
Mutual labels:  phone-number
react-forms-processor
A forms processor for React
Stars: ✭ 63 (+5%)
Mutual labels:  field
nova-money-field
Money Field for Laravel Nova
Stars: ✭ 71 (+18.33%)
Mutual labels:  nova
disposable-phone-numbers
A list of disposable phone numbers
Stars: ✭ 35 (-41.67%)
Mutual labels:  phone-number
flutter otp
A Flutter package for iOS and Android for sending and verifying OTP to a Phone number.
Stars: ✭ 59 (-1.67%)
Mutual labels:  phone-number
checkout
Laravel Cart, Checkout, Orders and Coupons API with Nova Management
Stars: ✭ 36 (-40%)
Mutual labels:  nova
Faker
A library for generating fake data such as names, addresses, and phone numbers.
Stars: ✭ 231 (+285%)
Mutual labels:  phone-number
nova-permissions
Add Permissions based authorization for your Nova installation via User-based Roles and Permissions. Roles are defined in the database whereas Permissions are defined in the code base.
Stars: ✭ 115 (+91.67%)
Mutual labels:  nova
Moriarty Project
This tool gives information about the phone number that you entered.
Stars: ✭ 223 (+271.67%)
Mutual labels:  phone-number
AsyncOpenStackClient
Asyncio wrapper to OpenStack API
Stars: ✭ 17 (-71.67%)
Mutual labels:  nova
static-calltracking
Скрипт подмены номеров для статического коллтрекинга
Stars: ✭ 18 (-70%)
Mutual labels:  phone-number
nova-algolia-card
A Laravel Nova card for Algolia
Stars: ✭ 22 (-63.33%)
Mutual labels:  nova
international-telephone-input
Integration to Magento 2 a jQuery plugin for entering and validating international telephone numbers.
Stars: ✭ 26 (-56.67%)
Mutual labels:  phone-number

Laravel Nova Phone Number Field

Latest Version on Packagist License Total Downloads

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

NOTE: This field utilizes Propaganistas / Laravel-Phone package for validation.

Image 1

Installation

To install this tool, use the installation code below:

composer require dniccum/phone-number

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

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

Defaults

Method/Options Default
format string: '(###) ###-####'
placeholder string: '[Name of Field]'
useMaskPlaceholder boolean: false
country string: 'US'
countries string[]: ['US']
disableValidation boolean: false
linkOnIndex boolean: false
linkOnDetail boolean: false

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

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

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

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 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 for validation.

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 country codes.

NOTE: This field utilizes Propaganistas / Laravel-Phone package for validation.

linkOnIndex

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

Type: boolean

Default: false

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

linkOnDetail

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

Type: boolean

Default: false

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

Credits

License

The MIT License (MIT). Please see License File for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].