- How do I install wilsenhc/laravel-rif-validation?
- Install it with Composer using composer require wilsenhc/laravel-rif-validation. The package ships a Laravel service provider that is auto-discovered, so no manual registration is needed in a standard Laravel application. There is no database migration, configuration file to publish, or asset build step. Start on the patched ^2.0.1 constraint rather than 2.0.0.
- Which Laravel and PHP versions does this RIF validation rule support?
- The package is built as a Laravel validation rule with auto-discovered service provider registration, which fits Laravel 10 and 11 style rule usage. The v2.0.0 major release likely raised minimum PHP, Laravel, and PHPUnit versions, so check the composer.json constraints against your runtime before merging. Pin the version in a committed composer.lock so CI stays deterministic.
- How do I use the RIF rule inside a Laravel FormRequest?
- Add the package's rule identifier as a string in your existing rules array, the same way you would use Laravel's first-party rules such as vat or regex. It requires no custom validation logic in your FormRequest or controller. The rule can also be used through manual Validator::make calls in API resources or other layers that already depend on the validator.
- Does the rule accept formatted RIF input like J-12345678-9 or only unformatted digits?
- The package documentation does not explicitly state whether hyphens and formatting are tolerated, so verify this against your own fixtures before relying on it. If your form input may include hyphens, normalize or strip them with a mutator before validation to be safe. This is the main integration decision to settle before wiring the rule into production form requests.
- What changed in v2.0.0 and why should I use v2.0.1 instead?
- Version 2.0.0 was a major bump that likely changed PHP, Laravel, or PHPUnit minimums and possibly the rule identifier or namespace. Version 2.0.1 is a one-line fix that pins the underlying rif-validation library to a stable release instead of allowing it to resolve to a non-stable build. That materially improves reproducibility and supply-chain determinism, so adopt ^2.0.1 directly and skip 2.0.0 entirely. Existing v1.x users should read the v2.0.0 upgrade notes and land on 2.0.1 in the same change.
- Does this package validate the RIF check digit and the J, V, E, P, or G prefix?
- Yes, the underlying rif-validation library verifies both the RIF format and its check digit. RIF validation is a rules-of-format problem with edge cases around prefixes, hyphenation, and zero padding, so behavior depends on that library's implementation. Confirm your own fixtures against it, since subtle format edge cases are easy to get wrong.
- Can I combine the RIF rule with unique or exists rules in one validation chain?
- The package exposes a standard Laravel validation rule, so it composes with unique and exists in the same pipe-delimited or array rule chain. This makes it usable on both Store and Update paths where the RIF must also be unique in your database. There are no persistence or HTTP concerns in the package, so ordering the rules is just normal Laravel behavior.
- Is there a published test corpus of valid and invalid RIF numbers?
- The package overview does not describe a published fixture corpus, so plan to build your own set of valid and invalid RIFs for tests. Running those fixtures against the rule early confirms the check-digit behavior matches your business expectations. This is especially worth doing if you validate Venezuelan supplier or customer tax IDs across billing and invoicing flows.
- Does the package require service provider registration or a config publish?
- No manual setup is required beyond Composer install, because the service provider is auto-discovered. There is no configuration file to publish, no database table, and no asset pipeline involved. That keeps it safe to use in containerized CI pipelines and in any layer that already depends on Laravel's validator.
- Should I use this package or write my own custom Laravel validation rule?
- This package is a thin wrapper around the standalone rif-validation library, so a local custom rule class wrapping the same library is a reasonable alternative. Write your own rule if you need to normalize or format RIF input before validating, or if you want to avoid adding a thin wrapper to your dependency tree. If you validate RIFs for multiple countries, put the check behind an interface rather than calling this rule by string name everywhere.