Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Phone Number

Phone Number Laravel Package

dniccum/phone-number

Simplify phone number handling in Laravel with validation and formatting helpers. This package provides a dedicated validation rule for international numbers, supports country codes, and helps store phone fields consistently across forms, APIs, and user profiles.

View on GitHub
Deep Wiki
Context7

dniccum/phone-number is a Laravel package that makes storing, validating, and formatting phone numbers effortless. Built on giggsey/libphonenumber-for-php, it offers an expressive API that normalizes numbers to E.164 while exposing formatted output, and it plugs directly into Eloquent via a custom cast.

  • Validation rule for form requests, with optional country-specific checks
  • Eloquent cast that persists E.164 and returns a rich PhoneNumber object
  • Formatting helpers for national, international, and RFC3966 output
  • Optional Twilio Lookup support for carrier and line-type metadata
  • Configurable default country and attribute accessors
Frequently asked questions about Phone Number
How do I install dniccum/phone-number in a Laravel app?
Install it with composer require dniccum/phone-number; Laravel package auto-discovery should register the service provider. For Nova usage, run nova:publish to publish the compiled JS and CSS assets, then replace Text::make('Phone') with PhoneNumber::make('Phone') on the resource. Budget roughly half a day to a day for installation, a staging spike, and smoke tests.
Does dniccum/phone-number work outside Laravel Nova?
The repository is a Laravel Nova field with input masking, while the supplied overview also advertises a standalone validation rule, Eloquent cast, and formatting helpers. Treat those as separate products until you read the source and confirm what actually ships in the Composer artifact. If you need canonical phone parsing in application code, keep that logic in your own domain layer rather than assuming this Nova field provides it.
What format does the Nova phone field save to the database?
The supplied material does not state whether the field persists the masked display string, raw digits, or E.164. This is the go/no-go question before touching a production resource, because a masked display value creates permanent data-quality debt. Answer it with a ten-minute staging spike that submits the form and inspects the column value.
How do I validate international phone numbers with this package?
If the advertised validation rule is present in the shipped artifact, use it in a FormRequest and configure the expected country where needed. If only the Nova field ships, do not count it toward your normalization roadmap; implement validation in application code with giggsey/libphonenumber-for-php or an equivalent library. Confirm the rule exists by reading the package source before approval.
Does it support E.164, national, and international phone formatting?
The overview says numbers normalize to E.164 and expose national, international, and RFC3966 output through a PhoneNumber object and helpers. Verify those APIs exist in the actual package artifact, especially if you are relying on them outside Nova. If they are only aspirational framing, the package contributes formatting only inside the admin panel.
Is Twilio Lookup required, and does it send phone data to a third party?
Twilio Lookup is described as optional metadata enrichment for carrier and line-type information. If it is genuinely invoked, it introduces a synchronous third-party network call on the Nova save path, per-lookup billing, and PII egress to a vendor. That is a security and legal review item, so confirm whether it can be disabled and whether any lookup happens by default.
Which Laravel and Nova versions does dniccum/phone-number support?
The supplied material does not specify supported Laravel or Nova majors, so inspect the composer.json constraint before adopting. The package has low ecosystem pressure and a single maintainer, so Nova upgrades may break it quietly. Pin the Nova constraint and add a CI job that asserts the field renders and the mask is active.
How does input masking affect international numbers and extensions?
Client-side masking and server-side validation are independent implementations and will drift. Masks are country-format-specific, so a US-shaped mask actively obstructs EU and APAC entry and can silently truncate extensions. Test paste, autofill, mobile numeric keyboards, screen readers, and CSP behavior as release gates, not nice-to-haves.
Is dniccum/phone-number safe and well maintained for production use?
It is MIT licensed with roughly 70 stars, zero dependents, and a single maintainer, which is an accepted but documented risk. Adoption is low-effort and forkable in hours, which materially de-risks the shallow integration surface. Assign a named owner, pin constraints, and make a fork-at-adoption decision before relying on it in production.
What alternatives should I consider for phone handling in Laravel?
Use giggsey/libphonenumber-for-php directly in application code for canonical parsing, validation, and E.164 storage, and treat this package only as a Nova UI veneer where phone numbers are incidental metadata. Avoid stretching it into messaging, deduplication, CRM sync, public forms, imports, or APIs. A custom Nova field or a dedicated Laravel validation rule are reasonable alternatives if you need tighter control.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo