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 throwInvalidFormatExceptionon invalid RUTs when exceptions are enabled (previously returnedfalsesilently). Inquiet()mode they still returnfalse.vnSeparator()now takes astring(the previousarraytype 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'andClp::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— newRut::check()(never throws),Rut::random()for factories/seeders,RutFormatenum,Stringable+JsonSerializable.- Laravel —
cl_rutandcl_phonevalidation rules with en/es translations,Rules\Rutrule object,RutCastEloquent 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
