Skip to content

Releases: awcodes/postal-codes

v1.0.2

Choose a tag to compare

@awcodes awcodes released this 09 Sep 18:44
25110cd

Fixed

  • lat and lng no longer lose precision. Coordinates were being rounded on write on MySQL, PostgreSQL and SQL Server.

Laravel 11 narrowed Blueprint::float() from float($column, $total, $places) to float($column, $precision = 53). PHP does not error on extra positional arguments to a userland method, so $table->float('lat', 10, 8) silently discarded the 8 decimal places and set the precision to 10.

A precision of 10 falls in the single-precision band on every driver that honours it: float(10) yields a 4-byte column of roughly 7 significant digits on MySQL, real on PostgreSQL, and a 4-byte real on SQL Server. A coordinate like 40.71277800 needs 10 significant digits, so the stored value was rounded. Dropping the stale arguments restores the default precision of 53, which maps to double / double precision and stores these values exactly.

SQLite is unaffected — it emits a bare float either way and stores the full double regardless. That is also why the test suite never caught this, and still cannot: the suite runs on SQLite, so the generated DDL is the only meaningful verification.

There is no compatibility risk in the change itself. maatwebsite/excel ^4.0 requires illuminate/support: ^12.0 || ^13.0, so this package is only installable on Laravel 12 or 13, and both carry the narrowed signature. Laravel 10 — the last version whose float() accepted (total, places) — is not reachable.

Anyone on v1.0.1 or earlier running against MySQL, PostgreSQL or SQL Server has coordinates stored at reduced precision. This release corrects the schema for new installs only. An existing table keeps its narrow columns, and the values already written to it were rounded at insert time, so recovering them means widening the columns and re-importing the source data — an ALTER alone will not bring the digits back.

v1.0.1

Choose a tag to compare

@awcodes awcodes released this 31 Aug 16:01

Fixed

  • The seed command no longer empties the postal_codes table before it has data to replace it with.

truncate() ran as the first statement in handle(), before the archive was downloaded or extracted. A mistyped country code, a network failure or an unreadable archive therefore emptied the table and returned FAILURE with nothing to put back — three separate failure paths sat after the truncate. The docs already stated that a failed download "exits without changing the table", which was not true until now.

The table is emptied immediately before the import instead, once the data file is in hand, and the archive is now checked for that file rather than letting the import throw. Behaviour on a successful seed is unchanged: the table still holds one country at a time.

Anyone on v1.0.0 running postal-codes:seed against a bad country code or a flaky connection could lose their imported data.

v1.0.0

Choose a tag to compare

@awcodes awcodes released this 31 Aug 15:26

First stable release. The only functional change since v0.2.0 is the Laravel Excel upgrade below; the rest is the platform floor moving with it.

Breaking changes

  • PHP 8.3 is now the minimum (was 8.2).
  • Laravel 12 is now the minimum (Laravel 11 is no longer supported).

Both follow from maatwebsite/excel moving to ^4.0, which requires php ^8.3 and illuminate/support ^12.0 || ^13.0. If you are on PHP 8.2 or Laravel 11, stay on v0.2.0.

Changed

  • Upgraded maatwebsite/excel from ^3.1 to ^4.0, which brings phpoffice/phpspreadsheet 1.x → 5.x.

The import path itself is unchanged. Every concern the package uses — ToModel, WithBatchInserts, WithCustomCsvSettings, WithProgressBar and the Importable trait — keeps its signature under Excel 4, and importing GeoNames data with leading-zero postal codes, non-ASCII place names, embedded quotes and empty columns produces byte-identical database rows on 3.1 and 4.0.

Added

  • PHP 8.5 support, now covered in CI. This was previously blocked by phpspreadsheet 1.x declaring php >=7.4.0 <8.5.0; phpspreadsheet 5.x has no upper bound.
  • A structured docs/ directory covering installation and usage.

Full changelog: v0.2.0...v1.0.0

v0.2.0

Choose a tag to compare

@awcodes awcodes released this 16 Jul 20:28
384a45e

Migrates the package onto the shared CI baseline and adds a real test suite. Includes two seeder fixes that change runtime behavior.

⚠️ Breaking

  • Requires PHP ^8.2 (was ^8.1). PHP 8.1 consumers stay on v0.1.2.

Fixed

  • postal-codes:seed never cleaned up after itself. The command wrote the archive via storage_path("app/{country}.zip") but checked and deleted it through Storage::disk('local'). Since Laravel 11 the local disk root is storage/app/private, so those are different directories — the re-download check always missed and cleanup silently did nothing, leaving the zip and .txt on disk after every run. All paths now resolve through the disk.
  • A cached archive was never extracted. The re-download guard also wrapped the extraction, so when a zip was already present the command skipped extracting and then tried to import a .txt that was never written. Extraction now always runs.

Added

  • Test suite: 25 tests covering the model, the GeoNames column mapping, service provider wiring, and the seeder command end to end. Previously the suite could not execute at all — Pest and testbench were never in require-dev.
  • Shared CI (awcodes/.github@v1): Tests, Lint, Static Analysis, and Reformat, with phpstan clean at level 5.
  • Dev toolchain: testbench, Pest 4, larastan, rector, collision. Canonical pint.json, rector.php, phpstan.neon.dist, and Dependabot config.

Notes

  • CI covers PHP 8.3–8.4 on Laravel 12/13. PHP 8.5 is not yet supported: maatwebsite/excel ^3.1 depends on phpoffice/phpspreadsheet, which declares php >=7.4.0 <8.5.0. It will be added once phpspreadsheet supports 8.5.
  • Codebase reformatted to the shared Pint ruleset (declare(strict_types=1) throughout).

Full Changelog: v0.1.2...v0.2.0

v0.1.2

Choose a tag to compare

@awcodes awcodes released this 22 Oct 14:11
aa7d5be

What's Changed

  • Fix: migration stub naming to allow for running by @awcodes in #5

Full Changelog: v0.1.1...v0.1.2

v0.1.1

Choose a tag to compare

@awcodes awcodes released this 21 Oct 20:37
3021b33

What's Changed

  • Feat: add model attributes to PostalCode model by @awcodes in #4

Full Changelog: v0.1.0...v0.1.1

v0.1.0

Choose a tag to compare

@awcodes awcodes released this 21 Oct 20:29
646b640

What's Changed

  • Feat: allow migrations to be loaded instead of published by @awcodes in #3

Full Changelog: v0.0.3...v0.1.0

v0.0.3

Choose a tag to compare

@awcodes awcodes released this 03 Apr 15:35
49584cb

What's Changed

Full Changelog: v0.0.2...v0.0.3

v0.0.2

Choose a tag to compare

@awcodes awcodes released this 22 Sep 17:41
e9fab72

What's Changed

  • various updates and truncate table in seeder by @awcodes in #1

New Contributors

Full Changelog: v0.0.1...v0.0.2

v0.0.1

Choose a tag to compare

@awcodes awcodes released this 19 Jun 16:17