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 Laravel Package

laravel-validation-rules/phone

Add reliable phone number validation to your Laravel apps with dedicated rules that verify international formats and reject invalid numbers. Simple, expressive syntax for form requests and validators keeps user data clean.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit This is a leaf-level, stateless adapter in the Laravel validation layer — it owns no schema, no queue, no cache, and no service boundary, so it can be dropped into any Laravel application without architectural negotiation. Its only real coupling is to the framework's Validator contract and (almost certainly) to giggsey/libphonenumber-for-php as the parsing engine. That makes it a low-blast-radius dependency: worst case, it is removed or replaced by an inline Rule object in a single PR. It is a natural fit for any system that ingests user-supplied phone numbers — registration, KYC, checkout, notification opt-in, CRM ingestion — where malformed input is currently handled by regex or not at all.

Integration feasibility Feasibility is high and effort is measured in hours, not sprints. Typical work: composer require, publish the config for a default region, attach the rule to the relevant FormRequest classes, and add localized messages. The real integration decisions are policy decisions, not code decisions: canonical storage format (recommend E.164 at rest), whether validation is strict (reject) or lenient (normalize-and-accept), and what region to assume when a user types a national-format number. Those should be agreed before the first PR.

Technical risk

  • Maintainer concentration. 69 stars and a single-primary-maintainer profile implies bus-factor risk. Apache-2.0 with no warranty means no vendor recourse; the mitigation is that the package is thin and forkable in an afternoon.
  • Metadata drift. Phone validity is not a closed-form problem — number plans change, ranges are reassigned, countries gain and lose formats. Correctness therefore depends on the cadence of the underlying libphonenumber metadata, which arrives only via dependency updates. A stale pin silently degrades to "rejecting valid new numbers" or "accepting retired ranges."
  • Semantic gap: valid ≠ reachable. The rule answers "is this a structurally plausible number for this region," not "will an SMS arrive." Stakeholders frequently conflate the two; scope this explicitly up front.
  • Normalization ambiguity. Validation and canonicalization are different concerns. If the package does not return a normalized value, the team must add an explicit normalization step or risk storing mixed formats that break dedupe, lookups, and downstream SMS/voice vendors.
  • Region resolution. Defaulting to a fixed country is a common and quiet bug for international user bases; region should derive from user locale/selection, not a hardcoded config value.
  • Competitive overlap. propaganistas/laravel-phone is the incumbent in this space with materially larger adoption. Choosing the smaller package is defensible only if its ergonomics, Laravel-version support, or message handling are meaningfully better — otherwise this is a gratuitous deviation from the ecosystem default.

Key questions

  1. Which versions of Laravel and PHP are supported, and is there a stated support/EOL policy?
  2. Does the rule expose the parsed/normalized E.164 value, or validate only?
  3. Can it validate by type (mobile vs. fixed-line vs. toll-free), and does it handle extensions?
  4. What is the behavior on ambiguous input — fail-open or fail-closed — and are exceptions converted to validation messages?
  5. How current is the pinned libphonenumber metadata, and what is the update cadence?
  6. Are error messages translatable, and do they ship with a translation set?
  7. Is there CI, a test suite, and a security disclosure path?
  8. Why this package over propaganistas/laravel-phone? Document the answer.

Integration Approach

Stack fit Fits cleanly into Laravel form requests, inline Validator::make calls, Fortify/Breeze/Jetstream registration flows, Nova/Filament resource forms, Livewire components, and API Resources via FormRequest-based controllers. It does not fit non-Laravel services — if the platform is polyglot, the correct pattern is to validate at the edge in Laravel and treat phone numbers as already-canonical E.164 downstream, so the rule never becomes a cross-service contract.

Migration path Treat as a like-for-like replacement for existing regex or custom Rule classes. Sequence: (1) inventory every place a phone is validated today; (2) introduce the new rule behind a config-driven default region; (3) run both old and new validation in shadow mode on real traffic for one to two weeks and diff the accept/reject sets; (4) flip the switch once the delta is understood. Step 3 is the step teams skip and regret — it surfaces every number the old regex allowed that the library rejects (and vice versa) before users feel it. Existing stored data needs a one-time normalization/backfill job if it is not already E.164.

Compatibility Two constraints to pin explicitly in composer.json: the Laravel major version and the PHP version. Check for conflicts with any existing phone, SMS, or twilio-style packages that also pull in libphonenumber — version skew there is the most likely install-time failure. Also confirm the package does not conflict with the incumbent propaganistas/laravel-phone if both are ever present during a transition.

Sequencing Week 1: evaluation spike, shadow-mode harness, decision on canonical format. Week 2: config + region-derivation policy, rule wired into forms, translations. Week 3: shadow diff analysis, backfill job, cutover. Week 4: remove legacy regexes, document the standard. This is a small, self-contained workstream — one engineer, part-time.

Operational Impact

Maintenance The ongoing cost is dependency hygiene, not code. Add the package to the routine composer update cadence and, more importantly, to a periodic review that checks whether the underlying number-plan metadata has moved. Budget roughly one half-day per quarter, plus a re-run of validation fixtures after each bump. Pin to a caret range, not a fixed version, so metadata updates land.

Support Apache-2.0, community-maintained, no SLA and no commercial backing. Support expectations should be set at "we can vendor or fork it if it is abandoned" — which is realistic here given the package's size. Assign a named internal owner so the fork path is not discovered during an incident. Include the license in the SBOM; Apache-2.0 is permissive and commercially safe, but the transitive libphonenumber license should be confirmed in the same pass.

Scaling Validation is CPU-bound and synchronous: sub-millisecond per call in typical use, with a fixed resident memory cost for the metadata tables (low single-digit MB, loaded once per process). It is a non-issue for form-submission volume and only becomes relevant if the rule is applied inside bulk import or batch-enrichment loops — there, validate once at ingest and store the canonical result rather than re-validating on every read. No external network calls means no added latency budget, no third-party availability dependency, and no data-residency concern from shipping phone numbers to a vendor.

Failure modes

  • Silent drift: stale metadata rejects newly allocated numbers; symptom is a slow rise in signup failures for specific countries. Detect with a daily canary of known-good numbers per region.
  • Region misconfiguration: national-format numbers validated against the wrong default country — a fixed config default is the usual culprit.
  • False confidence: teams treating a pass as deliverability and dropping their SMS vendor's own lookup, then blaming the rule for bounce rates.
  • Fail-open surprise: if the rule is configured leniently, invalid numbers reach downstream systems and only surface at send time.
  • Unnormalized storage: mixed formats defeating dedupe and unique constraints.
  • Dependency abandonment: no direct runtime failure, but a frozen metadata set that decays over months.

Ramp-up Effectively zero for any Laravel developer — the rule attaches like email or regex. The learnable content is the policy layer (region derivation, canonical format, strict vs. lenient), which is a one-page decision doc plus a short walkthrough. Estimate: one hour onboarding for a competent Laravel engineer, one day for the engineer owning the shadow-mode diff and backfill. No new tooling, no new operational surface, no on-call implication.

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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin