metarete/comuni-bundle
A PHP bundle that packages Italian comuni data—regions, provinces, cities, and CAP/postal codes—with ready-to-use entities, repositories, and import commands. Add searchable, up-to-date location data to forms, APIs, and address lookups without manual database setup.
Architecture fit. The package occupies the geospatial/domain-data layer of a Laravel application: it models records carrying latitude, longitude, and surface area (superficieKmq — square kilometres), most likely bound to Eloquent models and exposed through API resources or serializers. That is a narrow, well-understood responsibility and fits cleanly into a standard Laravel service architecture without imposing structural constraints on the host application.
What 1.0.9 changes. The release aligns the decimal types of lat, lon, and superficieKmq to string. This is a data-contract change, not a cosmetic one. Coordinates and area values that previously surfaced as float/decimal now surface as strings. In PHP this has real consequences: === comparisons, is_float()/is_numeric() guards, arithmetic, array_sum, sort callbacks, JSON payload shape, and any typed DTO or constructor property (float $lat) will behave differently or hard-fail.
Why it is defensible. Returning decimals as strings is idiomatic in Laravel — Eloquent's decimal:8 cast has always yielded strings, precisely to avoid IEEE-754 precision loss on coordinates and money-like values. If the package previously coerced to float, 1.0.9 plausibly fixes a latent precision bug (a coordinate silently rounded before persistence or serialization is a serious geospatial defect). The direction of the change is therefore sound; the concern is the delivery, not the intent.
Technical risk.
^1.0 will absorb it silently on composer update. This is the single largest risk in the release."45.4642" may pass unnoticed until an arithmetic or map-library call receives a string.numeric rule accepts numeric strings, but integer/decimal rules and cast declarations may not align; custom validation or whereBetween query scopes on these columns need review.DECIMAL, the PHP-side change likely matches reality and reduces surprise. If they are FLOAT/DOUBLE, the package and schema now disagree.Key questions for the maintainer.
1.1.0 / flagged as breaking?superficieKmq, and is the string format locale-independent (. separator, no thousands separator)?null coordinates still null, or now ""? Empty-string-vs-null is a frequent regression in this class of change.toArray(), accessors) covered by tests asserting the string type?Stack fit. Standard Laravel/PHP — Composer-installed, Eloquent-backed. No framework-version signal in the release note, but a 1.0.x line implies Laravel 9–11 era support. Nothing here affects queue drivers, cache, or HTTP layer, so the integration surface is confined to models, casts, and serialization.
Migration path. Low-effort but not zero-effort, and it must be deliberate:
1.0.8) before touching composer.json, so the type change cannot arrive unannounced in CI.lat, lon, superficieKmq: strict comparisons, arithmetic, number_format, typed properties, and any float-hinted DTOs or method signatures.bccomp or cast explicitly at the boundary ((float) $model->lat) where a float is genuinely needed.declare(strict_types=1) in scope; that is where string/float mismatches surface fastest.Compatibility. Backwards-incompatible at the type level for any consumer doing strict typing or arithmetic. For consumers that only render values into views or JSON, impact is likely cosmetic — JSON already emitted decimals as strings in most Eloquent configurations, so the practical delta may be smaller than the changelog implies. Verify rather than assume.
Sequencing. Upgrade in a branch, not on main. Steps: pin → audit usages → bump → run full suite plus any API contract tests / snapshot tests → inspect a serialized payload byte-for-byte against the old one → deploy to staging behind any geospatial feature flag → production. If the package has downstream dependents inside the org, coordinate the bump rather than letting composer update fan it out.
Maintenance. The package is small and the change is one line of intent; ongoing maintenance burden is negligible. The real maintenance cost is downstream: every consumer now carries string-typed coordinates and must be disciplined about casting at the boundary rather than deep in domain logic. Document the convention once, in the consuming app, not per-model.
Support. Expect at least one round of "coordinates render as \"45.4642\" on the map" bug reports if a front-end consumes the payload directly. A one-line note in the internal changelog — "coordinates and area are decimal strings from 1.0.9" — pre-empts most of it. Maintainer-side, the semver discrepancy is worth raising as a support issue in its own right, since it undermines the ability to trust ^1.0 constraints going forward.
Scaling. No performance or scaling implication. Strings are marginally larger in payloads and marginally slower to compare than floats, but at any realistic record count this is noise. If the data is bulk-exported or fed to an analytics pipeline, confirm the downstream warehouse ingests decimal strings cleanly rather than inferring them as text columns — that is the one place where a silent type change can propagate into a data model.
Failure modes.
"45,4642") breaks every numeric parser downstream. Verify format explicitly."" rather than null will break whereNotNull scopes and nullable validation.composer update in a sibling service pulls the change in with no code review. This is the highest-probability failure and the cheapest to prevent via pinning.Ramp-up. Effectively zero for a developer already fluent in Laravel; the package's surface is a handful of attributes. The ramp-up cost is entirely in discovering the type contract — half a day of auditing usages for a mid-sized codebase, primarily grep-and-verify rather than design work. Allocate that time explicitly; the temptation to treat a one-line changelog as a no-op is exactly how this change bites.
Recommendation. Adopt 1.0.9 — the string representation is the technically correct choice for decimal coordinates — but adopt it deliberately: pin, audit, verify null and format behaviour, and raise the semver classification with the maintainer so future type changes arrive as minor or major bumps.
How can I help you explore Laravel packages today?