laragear/rut
Laragear/RUT brings Chilean RUT handling to Laravel: validate, format, and generate Rol Único Tributario values with a clean rule, cast, and helper-based API. Lightweight, framework-friendly, and ready for forms, models, and validation pipelines.
Install the package and try the validation rule first — it is the highest-leverage entry point:
composer require laragear/rut
Then, in a FormRequest, use the rut rule. The package auto-registers it:
public function rules(): array
{
return [
'rut' => ['required', 'rut'],
];
}
Look first at the Rut facade (or the rut() helper) for one-off normalization, and at RutCast if you store RUTs on Eloquent models. The v5.3.0 addition of static RUTs is the new first-use case worth knowing: you can now get a deterministic, valid RUT for fixtures, seeds and test assertions instead of a random one, and the same value can be reused across test runs.
rut rule string in FormRequest classes and inline Validator::make() calls. It handles format (with or without dots/dash), the check digit (DV/K) and rejects garbage input.RutCast (or the alias) to $casts so $model->rut returns a normalized string and rejects invalid values on assignment. Combine with a rut column type of string and an accessor if you need dotted display.fake()/factory context; reserve the static generator for places where you assert on an exact value.Rule::when(...) block or a custom rule rather than sprinkling rut across every request.unique column, keep using the random generator or a real source. Also check your existing test dummies: static RUTs were removed from validation dummies, so any assertion relying on a hardcoded dummy value should be migrated to the new static generator.Rut::normalize($input) or equivalent helper) before blaming the rule; most "valid RUT is rejected" reports are formatting artifacts such as trailing whitespace or non-breaking spaces pasted from spreadsheets.rut rule in a named custom rule if you need custom messages, or override the validation message in lang/ rather than editing the package. Prefer the facade/cast boundary over touching package internals when you need project-specific normalization.How can I help you explore Laravel packages today?