$ show antonioribeiro/countries
This is a PHP library providing comprehensive geographic and geopolitical data for over 260 countries, including currencies, timezones, taxes, flags, administrative subdivisions, cities, and map boundaries (GeoJSON/TopoJSON). The package is designed for applications that need offline access to richly structured country data, such as form validation, e-commerce tax calculation, map rendering, and localization. The core architecture leverages a lazy hydration pattern to load expensive data on demand, a custom extended Laravel Collection with case-insensitive and magic property access, and a configurable cache layer (PSR-16). Data is stored as thousands of static JSON files organized by type and country code, sourced from Natural Earth, mledoze, timezonedb, and other public datasets. Update scripts exist but are not automated, and the data snapshot has some stale entries (e.g., obsolete currency codes). The package shows solid engineering for its niche but has minimal test coverage and no automated data freshness checks.
The LLM identified 2 files worth highlighting for reuse:
A custom implementation extending Illuminate\Support\Collection that provides case-insensitive key access, magic property access using `__get`, and dynamic conversion of underscore-separated keys (e.g., 'europe_paris' to 'Europe/Paris') to support fluent querying of nested country data. This component is self-contained and can be extracted to provide enhanced collection behavior in any PHP project that needs flexible, chainable data access.
Implements a lazy hydration pattern for 13 different data element types (borders, cities, currencies, etc.) that are loaded only when accessed via dedicated `hydrate*` methods. Each country object tracks which elements have been hydrated and caches the result to avoid redundant loading. This pattern is reusable for any data-heavy application that needs on-demand enrichment of entities without upfront cost.