giggsey/libphonenumber-for-php
57.5
Adequate · 17 November 2026
493.8k
lines of production code
PHP
primary language
5
measurements over time
What this system is
Features
Add offline phone number geocoding capability
Introduces the PhoneNumberOfflineGeocoder class, enabling users to retrieve human-readable text descriptions (such as country or area names) for valid phone numbers based on their geographic location. This new feature allows applications to display localized location details for phone numbers without requiring an online service, supporting both full country names and more specific regional descriptions depending on the user's locale and region.
src/geocoding · high confidence
Added leniency levels for phone number validation strictness
The library now supports configurable leniency levels to control how strictly phone numbers are validated during matching. Four new classes—Possible, Valid, StrictGrouping, and ExactGrouping—extend the AbstractLeniency base class, allowing users to choose between accepting any possible number, requiring valid format, enforcing national prefix presence, or demanding exact digit grouping. This enables more precise control over which phone number candidates are accepted by the matcher.
src/Leniency · high confidence
Behavioural changes
Carrier data updated to libphonenumber-for-php v9
The carrier lookup data in src/carrier has been regenerated from the upstream libphonenumber-for-php v9 dataset. This update refreshes the internal carrier mapping tables (e.g., Map.php and language-specific files like En\_1.php, Be\_375.php) to reflect the latest mobile network operator assignments and numbering plan details provided by Google.
src/carrier · high confidence
Major library upgrade to v9 with AsYouTypeFormatter and PhoneNumberMatcher
The library has been upgraded to version 9.0.36, introducing the AsYouTypeFormatter for real-time phone number formatting as digits are entered and the PhoneNumberMatcher for extracting phone numbers from text. The internal architecture has been refactored to store metadata in dedicated objects (PhoneMetadata, PhoneNumberDesc) instead of arrays, and the codebase has been modernized with strict typing, PHP 8.1/8.4 compatibility, and the use of native enums for types like CountryCodeSource and MatchType.
src · high confidence
New PHP-based build system for phone number metadata
The project has replaced its previous build tooling (Phing) with a new PHP-based command-line application located in the \build/\ directory. This new system uses Symfony Console and Nette PhpGenerator to parse XML metadata and generate optimized PHP data files for phone prefixes, time zones, and region codes. This change is part of the broader v9 release, which also includes PHP 8.1 and 8.4 compatibility updates and the addition of short number support.
build · high confidence
Refactored prefix mapper to use dedicated data classes
The phone prefix mapping logic in src/prefixmapper has been restructured to store metadata and data in dedicated classes rather than raw arrays. New classes include MappingFileProvider for managing available data files, PhonePrefixMap for mapping prefixes to descriptions, PrefixFileReader for handling file loading and language fallback, and PrefixTimeZonesMap for retrieving timezone information. This change improves type safety and maintainability of the prefix mapping system.
src/prefixmapper · high confidence
Replace Phing build system with Symfony Console commands
The build process for libphonenumber metadata has been migrated from the Phing tool to a set of PHP scripts using the Symfony Console component. This change introduces new command-line tools (BuildCommand, BuildMetadataPHPFromXMLCommand, GeneratePhonePrefixDataCommand, and GenerateTimeZonesMapDataCommand) that handle the generation of phone number, carrier, timezone, and geocoding data files. Users building the library from source will now use these Symfony-based commands instead of the previous Phing targets.
build/Commands · high confidence
Standardize repository configuration and build tooling
The project now includes standardized configuration files to improve developer experience and code consistency: an .editorconfig enforces UTF-8, LF line endings, and specific indentation rules; a .gitattributes and .gitignore ensure build artifacts, tests, and IDE files are excluded from exports and version control; and a new .php-cs-fixer.dist.php configures the PHP CS Fixer with PSR-12/PER-CS2.0 standards and PHP 8.1 migration rules. Additionally, the legacy Phing build file (build.xml) has been removed, signaling a shift away from the previous build system, while new phpunit.xml.dist, phpstan.neon.dist, and infection.json5 files establish modern testing, static analysis, and mutation testing configurations.
(repo-wide) · high confidence
Updated geocoding data from upstream libphonenumber
The geocoding data files in src/geocoding/data have been regenerated from the upstream libphonenumber metadata. This update refreshes the internal mapping of phone number prefixes to geographic locations (e.g., city and region names) for supported languages, ensuring that geocoding results reflect the latest upstream changes.
src/geocoding/data · high confidence
Updated phone number formatting metadata for multiple countries
The library's internal data files in src/data have been regenerated to reflect upstream metadata changes from Google, introducing new or updated alternate formatting rules for countries including Tanzania (255), South Africa (27), Greece (30), the Netherlands (31), Spain (34), Gibraltar (350), Portugal (351), Luxembourg (352), Finland (358), Bulgaria (359), Hungary (36), Estonia (372), Moldova (373), Ukraine (380), Serbia (381), Croatia (385), Italy (39), Austria (43), the United Kingdom (44), Germany (49), Nicaragua (505), Costa Rica (506), Mexico (52), Argentina (54), Brazil (55), Venezuela (58), Paraguay (595), Australia (61), and Indonesia (62). These updates ensure that phone numbers from these regions are formatted according to the latest official patterns.
src/data · high confidence
Test coverage
Added core unit tests for libphonenumber components; Added regression tests for specific phone number handling issues; Added test bootstrap configuration; Added test data for carrier and prefixmapper lookups; Added test data map for timezone validation; Added tests for PhoneNumberToCarrierMapper; Added tests for phone number to timezone mapping; Added unit tests for build tool metadata and prefix generation; Added unit tests for geocoding and prefix mapping; Updated test metadata for libphonenumber.
Dependencies
Initial release of libphonenumber-for-php v9 with PHP 8.1+ and modern tooling
This entry introduces the v9 major version of the library, establishing a new baseline that requires PHP 8.1 or higher and adopts PSR-4 autoloading. The dependency stack has been modernized to use giggsey/locale ^2.7 and symfony/polyfill-mbstring ^1.31, while development tooling has been updated to PHPUnit ^10.5.45, PHPStan ^2.1.7, and PHP-CS-Fixer ^3.71. The package is configured to replace giggsey/libphonenumber-for-php-lite and includes build scripts for metadata generation and static analysis.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 56.1 → 57.5 (+1.4)
- Rubric changed (rubric-2026.11.2 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 66.8 → 66.8 (0.0)
- Architecture 65.3 → 75.2 (+9.9)
- Maturity 55.4 → 59.1 (+3.7)
- Readiness 49.2 → 48.3 (-0.9)
- Security 86.9 → 86.9 (0.0)
Resolved (1)
- Projects may be oversized for their cohesion
New (4)
- Circular dependency (src/Leniency.php)
- Edited copy of a member (11 corresponding lines) (src/PhoneNumberToTimeZonesMapper.php)
- Edited copy of a member (21 corresponding lines) (src/Leniency/ExactGrouping.php)
- Off the main sequence: src/timezone
Changes since last survey
- 2 commits — 2 feature/other, 0 fixes
By area
- (repo) — 1 commit
- src/carrier — 1 commit
Notable commits
- change: Merge pull request #777 from giggsey/upstream-9.0.43
- change: Upstream metadata changes from Google for v9.0.43
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
giggsey/libphonenumber-for-php was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 17 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 75a801c3dbf9a675e4bc83e0da2c2142fcc5344d — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.85+preprod-eba6548ac50f.