giggsey/libphonenumber-for-php-lite
A lightweight PHP library for parsing, formatting, storing, and validating international phone numbers, based on Google's libphonenumber. This lite version includes core phone number utilities and requires PHP 8.1+ with mbstring.
+<country><number> string with the user's raw input preserved alongside, instead of free-text phone fields. This is a schema decision that is expensive to reverse after international growth.isValidNumber and getNumberType let you split "malformed" from "wrong country code" from "valid but wrong type" (e.g. a premium-rate or VoIP number on a lead form) and set differentiated product behavior per case.getNumberType distinguishes fixed-line, mobile, toll-free, premium rate, shared cost, VoIP, and personal numbers. This underwrites roadmap decisions for SMS-first features (mobile-only OTP, mobile-only notifications) and risk decisions (blocking premium-rate ranges on paid flows).isNumberMatch returns a confidence level that two inputs are the same number, which directly supports duplicate detection, deduplication of imported CRM records, and rate-limit/abuse rules keyed to a real identity rather than a typed string.getExampleNumber / getExampleNumberByType gives valid fixtures for every region — useful for seeding demo tenants, QA matrices, and localization testing without inventing fake numbers that fail validation.giggsey/libphonenumber-for-php. Roadmap items like "detect the carrier to route SMS" or "restrict by region from a phone number" are explicitly out of scope here and should be costed against the full package before being promised.Adopt when:
Look elsewhere when:
giggsey/libphonenumber-for-php instead of trying to extend this one.Dependency-health note for the decision record: this specific repo shows modest standalone community signal (99 stars, low dependent count), but it is a satellite of a long-established, widely used parent project and is built from Google's upstream metadata with Apache-2.0 licensing. The practical risks are a thin maintainer base and release cadence tied to Google — both mitigable by wrapping the library behind your own interface.
For executives (one paragraph): Phone numbers are the primary identity and messaging channel for a large share of our users, and today we treat them as free text. Adopting this library — an Apache-2.0 PHP port of Google's industry-standard libphonenumber — lets us validate, normalize, and format numbers for every country without building or maintaining country-by-country rules ourselves. There is no license cost, no vendor contract, and no new infrastructure. The business outcomes are reduced undeliverable SMS and wasted messaging spend, fewer failed signups caused by formatting errors, cleaner customer records for analytics and deduplication, and the ability to enter new markets without a phone-handling engineering project each time. The main cost is a small integration effort plus a recurring dependency-update chore.
For engineering leadership: This is a well-understood commodity dependency, not a differentiator. Recommendation is to adopt the lite edition behind a thin internal PhoneNumberService adapter (parse, validate, normalize to E.164, format for display, compare for duplicates) so the library never leaks into domain code and swapping to the full package — or to an external API for carrier data — stays a one-file change. Constraint to accept up front: versioning follows Google's numbering, not SemVer, so upgrades should be pinned, scheduled, and covered by our own fixture tests rather than auto-merged. Note also that the parent project is effectively single-maintainer; Apache-2.0 and the upstream Google metadata mean the exposure is low, but it belongs in the dependency-risk register rather than being assumed away.
Scope boundary to state explicitly in the pitch: this gets us parse/validate/format/type/compare. It does not get us carrier lookup, geolocation, or short-number handling — if any of those are in the near-term roadmap, the decision should be scoped against the full package from the start rather than retrofitted later.
How can I help you explore Laravel packages today?