Skip to content

v3.0.0 — Modernización completa 🇨🇱

Latest

Choose a tag to compare

@gdespirito gdespirito released this 11 Jul 05:57
9953bb3

Chilean Bundle

The package has been fully modernized. Requires PHP 8.2+ (and Laravel 10+ for the Laravel integration; tested against 11 and 12).

Still on PHP 5.x/7.x? The legacy 2.x series remains available: composer require freshwork/chilean-bundle:^2.2

Note on numbering: the previous stable series was 2.x (up to 2.2.0), so this major release is v3.0.0. See the upgrade guide in the README.

⚠️ Breaking changes

  • PHP 8.2+ required (was >=5.4.0).
  • format() / normalize() now throw InvalidFormatException on invalid RUTs when exceptions are enabled (previously returned false silently). In quiet() mode they still return false.
  • vnSeparator() now takes a string (the previous array type hint was a bug that made the method unusable).

✨ New features

  • Iva — Chilean VAT constants (RATE, PERCENTAGE) and calculations: of(), add(), net(), fromGross(), rounded to the peso.
  • Clp — Chilean peso formatting: Clp::format(1234567)'$1.234.567' and Clp::parse().
  • Phone — Chilean phone validation and normalization: mobile/landline detection, E.164 and human-readable formats.
  • Region — enum with the 16 regions: official names, roman numerals, capitals, north-to-south order, options() for selects.
  • Comuna — enum with the 346 comunas backed by their official CUT code (generated from the SUBDERE spreadsheet): officialName(), code(), region(), fromName(), inRegion().
  • Rut — new Rut::check() (never throws), Rut::random() for factories/seeders, RutFormat enum, Stringable + JsonSerializable.
  • Laravelcl_rut and cl_phone validation rules with en/es translations, Rules\Rut rule object, RutCast Eloquent cast with configurable storage format.

🔧 Quality

  • Full type coverage with declare(strict_types=1).
  • 105 tests / 952 assertions (Pest 3 + Testbench), PHPStan level 8, Laravel Pint.
  • CI matrix PHP 8.2–8.5 + lint job, Dependabot.

Full Changelog: 2.2.0...v3.0.0