- How do I install resultsystems/validation in a Laravel application?
- Run composer require resultsystems/validation and rely on Laravel package auto-discovery. On older Laravel versions you may need to register the service provider manually. You can optionally publish config and translation files if you need to customize messages.
- Which validation rules does resultsystems/validation add to Laravel?
- It adds Brazilian-oriented rules such as CPF, CNPJ, CEP, and phone number formats, plus a few convenience rules. These plug into Laravel's existing validator pipeline, so they work in FormRequests, inline validators, and API request objects. Confirm the exact rule names in the README before adopting them.
- Does resultsystems/validation support Laravel 10, 11, and 12?
- The package claims support from Laravel 5.x through 12.x. That range spans many framework API changes, so verify CI status and test on your exact Laravel and PHP versions. Do not assume the highest or lowest version is fully exercised.
- How do I use a CPF or CNPJ rule inside a Laravel FormRequest?
- Reference the rule in your rules array as a pipe-delimited string or a rule object, depending on the Laravel version. The package integrates with Laravel's normal validation flow, so no middleware or container changes are required. Keep rule names centralized in app-owned rule classes to simplify future swaps.
- Is resultsystems/validation maintained and safe for production?
- Adoption is thin, with roughly 28 stars, which means limited community scrutiny and a credible single-maintainer risk. The code is pure input validation with no I/O or deserialization, so runtime security exposure is small. For production, fork or vendor the few rules you actually use so abandonment is not a blocker.
- Can I use resultsystems/validation with Laravel ValidationRule objects?
- Laravel is gradually moving from string rules to ValidationRule objects, and the package's support for that contract depends on its version. Check the package source and tests for your target Laravel release. If needed, wrap the package rules in your own ValidationRule classes to get a stable interface.
- Are the validation messages in Portuguese, and can I translate them?
- The package targets Brazilian formats, so default messages may be Portuguese or may not cover every locale. Publish the translation files if available and override messages in your lang files. For non-Portuguese APIs, define custom messages in your FormRequests or app-owned rule wrappers.
- How should I test CPF and CNPJ validation in Laravel?
- Use Laravel's Validator facade in feature or unit tests with known valid and invalid documents. Assert both passing and failing cases, including formatted and unformatted input, and check the exact error messages. Repeat the tests on every Laravel and PHP version you support.
- What are alternatives to resultsystems/validation for Brazilian document validation?
- Alternatives include laravellegends/pt-br-validator, custom ValidationRule classes, or simple regex and check-digit logic for the few documents you need. Laravel core does not include CPF or CNPJ rules. Compare maintenance, test coverage, and message localization before choosing.
- Does resultsystems/validation work with Laravel Octane and long-running workers?
- The rules appear stateless and perform no I/O, so they should behave correctly under Octane and long-running workers. Confirm there is no static caching of parsed documents in the version you install. Also ensure your app-owned rule wrappers do not introduce shared mutable state.