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.
This release (1.0.9) is a small but behavior-affecting change: the lat, lon, and superficieKmq attributes are now cast to string rather than a numeric/decimal type. Start by checking the package's model casts (and any published config) to confirm where these casts live, then run your test suite before upgrading.
Minimal steps:
composer require the package (or bump to ^1.0.9) and run php artisan vendor:publish if the package ships migrations/config.lat, lon, and superficieKmq — look for $casts entries such as 'lat' => 'decimal:7' that were changed to 'string'.decimal(10,7) vs varchar) — the cast change does not alter schema, so string casts over decimal columns are expected.$model->lat, $model->lon, and $model->superficieKmq come back as strings (e.g. "45.4642000"), including in toArray()/JSON responses.lat/lon/superficieKmq straight into API resources, forms, and views without re-casting.(float) $model->lat, (float) $model->superficieKmq, or use bcmul/bcadd for precision-sensitive math.numeric rules rather than decimal casts, since the model now returns strings.(float) and document it. Consistency across endpoints matters more than the choice.bccomp((string) $a, (string) $b, 7) — rather than relying on loose ==.===) and is_numeric-adjacent logic. Any code doing $model->lat === 45.46 or $model->superficieKmq > 0 may now behave differently; audit comparisons and assertions in tests."45.4642000"), which can surprise front-end consumers expecting numbers. Update TypeScript types, OpenAPI schemas, and JS parsers accordingly."45.4642000") will surface in output. Trim with rtrim($v, '0') or format explicitly if the UI expects clean values.sort/sum on string values will misbehave — cast before collection operations.decimal validation rules are aimed at numeric strings and remain workable, but numeric plus between is usually clearer now; ensure your FormRequests accept strings.$model->getCasts() and dd($model->getAttributes(), $model->toArray()) to see raw vs. cast values when output looks wrong.getLatAttribute) rather than patching vendor code, so future releases don't clobber your change.composer.json if downstream consumers depend on numeric serialization until you've migrated them.How can I help you explore Laravel packages today?