giggsey/libphonenumber-for-php-lite
Lite PHP port of Google’s libphonenumber: parse, validate, format, and store international phone numbers. Includes core PhoneNumberUtils only (no geolocation/carrier/short number info). Requires PHP 8.1+ and mbstring; install via Composer.
Global User Onboarding & Data Validation:
+1 (123) 456-7890 instead of raw input like 1234567890).Compliance & Fraud Prevention:
123 or flag high-risk toll-free/premium-rate numbers).Localization & Regional Expansion:
044 668 18 00 in Switzerland vs. +41 44 668 18 00 globally).Cost Optimization:
Roadmap Priorities:
libphonenumber-for-php later).libphonenumber-for-php package).libphonenumber-for-js).mbstring extension support."This package lets us handle phone numbers globally—like Google does—without building or licensing custom solutions. It’s used by [X] companies to validate signups, reduce fraud, and localize UX. For example, it’ll auto-format a Swiss number as +41 44 668 18 00 instead of rejecting it as invalid. It’s lightweight, maintained by the same team as Google’s libphonenumber, and avoids vendor lock-in. We can start with core validation (Phase 1) and expand to number-type features (Phase 2) as we grow."
ROI:
123 instead of +1 123 456 7890).044 668 18 00 in CH vs. +41 44 668 18 00 globally).*"This is a PHP port of Google’s libphonenumber (lite version), giving us:
044 668 18 00 → +41446681800 with country context.E164 (+41446681800), NATIONAL (044 668 18 00), or INTERNATIONAL (+41 44 668 18 00).getExampleNumber('US') → +1 650 253 0000).Why not build?
Integration:
// Validate a Swiss number
$phoneUtil = \libphonenumber\PhoneNumberUtil::getInstance();
$number = $phoneUtil->parse('044 668 18 00', 'CH');
if ($phoneUtil->isValidNumber($number)) {
echo $phoneUtil->format($number, \libphonenumber\PhoneNumberFormat::E164);
// Output: +41446681800
}
Next Steps:
valid_phone:CH).libphonenumber-for-php if geolocation/carrier data is needed."*How can I help you explore Laravel packages today?