Google has bumped libphonenumber to v9 for Java compatibility reasons. We've taken this opportunity to make some improvements to this library.
Most projects can upgrade safely without requiring any code changes.
PHP Changes
- Minimum PHP version: Now 8.1+.
- Function & parameter types: All functions and parameters now have explicit type definitions.
- Backed Enums replace const classes:
- Example:
PhoneNumberTypeis now an enum instead of a class with constants. - If you previously referenced the constants directly, no changes are required.
- If you stored constant values (integers), you'll need to use
from()to load the corresponding enum.
- Example:
- Metadata storage improvement:
- Metadata is now stored directly in PHP classes instead of arrays.
- This improves performance when loading metadata but does not affect usage.
Google v9.0.0 changes: Feb 27, 2025
Metadata changes:
- Updated alternate formatting data for country calling code(s): 385
- Updated phone metadata for region code(s):
AR, BL, GF, GP, GY, HK, JP, MF, RE, SG, SL, SN, TJ, UG, VE, ZA - Updated geocoding data for country calling code(s): 27 (en)
- Updated carrier data for country calling code(s):
58 (en), 65 (en), 221 (en), 256 (en), 592 (en), 852 (en, zh), 992 (en) - Updated / refreshed time zone meta data.