- How do I install laragear/rut in a Laravel application?
- Install the package with Composer by running composer require laragear/rut. Laravel package auto-discovery should register the service provider, so manual provider configuration is normally unnecessary. After installation, you can use the RUT validation rule, Eloquent cast, and helpers in your application. Run your RUT-specific tests after the first install to confirm everything works in your environment.
- Which Laravel and PHP versions does laragear/rut support?
- Support depends on the package's composer.json constraints, so check those for v5.3.0 before upgrading or adopting it. The v5.3.0 release is a minor version and the notes do not indicate a Laravel or PHP support break. The StyleCI PHP version change mentioned in the release is CI-only and should not affect runtime compatibility. Confirm the support matrix against your application's runtime in a branch before merging.
- How do I validate a Chilean RUT in a Laravel form request?
- Use the package's RUT validation rule in your form request rules array, either as the rule class or the documented string alias. The rule handles Chilean RUT format and check digit validation, including the K check digit. Combine it with required or nullable depending on whether the field is mandatory. Test with malformed values, formatted values, and valid RUTs generated by the package to confirm behavior.
- How do I format a RUT with dots and hyphen in Laravel?
- The package provides formatting helpers so you can output a RUT with thousands separators and a hyphen before the check digit. Use the documented helper or cast method instead of writing your own formatter. Keep stored values normalized and format only at the presentation layer, such as Blade views or API resources. Formatting is stateless and cheap, so it is safe to call in resources.
- Does laragear/rut provide an Eloquent cast for RUT attributes?
- Yes, the package includes an Eloquent cast so RUT attributes can be handled consistently in your models. This helps keep validation, formatting, and comparison logic out of your model classes. Apply the cast in the model's casts array and use the package's formatting features for display. Check nullable and dirty-attribute behavior in your own model tests.
- What are static RUTs in laragear/rut v5.3.0?
- v5.3.0 adds support for static RUTs, which are fixed RUT values useful for deterministic tests, factories, seeders, and demo data. The release also removes static RUTs from validation dummies, so the new API should be treated as the stable way to reference fixed values. Review the package documentation for the exact public API and whether it is intended for production or test fixtures. If your tests relied on the removed dummy values, replace them with static RUTs or your own fixtures.
- Is upgrading laragear/rut from v5.2.1 to v5.3.0 safe?
- It is a semver minor release and the notes do not indicate breaking public API changes, so it should be a backward-compatible upgrade. The main risk is behavioral or test-fixture drift if your tests, factories, seeders, or validation examples used the removed validation dummies. Upgrade in a branch with Composer, commit the lockfile, and run all RUT-specific unit and feature tests. Search your codebase for hard-coded RUT fixtures before merging.
- Can laragear/rut generate valid RUTs for factories and seeders?
- The package supports generation of RUT values, which is useful for model factories, seeders, and test data. Use generated RUTs for tests that need valid check digits rather than hard-coding values. For deterministic tests, prefer the static RUT support added in v5.3.0. Keep generated values out of production seed data unless the data is clearly marked as sample data.
- Does laragear/rut validate the K check digit?
- Yes, Chilean RUT validation includes the check digit, and the package handles the K check digit as part of its rule. Values ending in K should validate correctly when the rest of the RUT is valid. You should still test lowercase k and formatted versus unformatted input if your forms accept both. Normalize input before storage and format only for display.
- What are alternatives to laragear/rut for Chilean RUT validation in Laravel?
- Alternatives include writing a custom Laravel validation rule or using a general-purpose Chilean RUT library wrapped in your own rule. laragear/rut is a narrow, framework-friendly option with a rule, Eloquent cast, and helpers, so it reduces custom code. Evaluate maintenance activity, PHP and Laravel constraints, and whether static RUT fixtures matter to your tests. For critical business logic, consider a thin internal wrapper so you can swap implementations later.