- What is geekcom/validator-docs used for in Laravel?
- It provides Laravel validation support for Brazilian documents such as CPF, CNPJ, CNH, NIS, DDD, Título Eleitoral, and Cartão Nacional de Saúde. The package also includes an Artisan command that scans validation rules and generates Markdown tables for rule parameters and descriptions. Use it when you need Brazilian document validation and want validation docs kept in sync with code.
- How do I install geekcom/validator-docs in a Laravel application?
- Install it via Composer with composer require geekcom/validator-docs, then follow the package README for any service provider or config publishing steps. Because it is a Composer-installed Laravel package, integration normally means updating the dependency and applying the rules in FormRequests or validators. Test the installation in a branch before deploying to production.
- Does geekcom/validator-docs support alphanumeric CNPJ validation?
- Release 3.12.0 adds validation for alphanumeric CNPJ, which aligns with Brazil’s planned transition to alphanumeric CNPJ identifiers. The provided notes do not specify whether this is a new rule or a change to the existing cnpj rule, so verify the behavior in tests. Validate both legacy numeric and new alphanumeric values where your application needs to accept both formats.
- Is alphanumeric CNPJ validation a new rule or a behavior change to the existing CNPJ rule?
- The provided release assessment does not confirm this and lists it as a key question to verify. Treat the feature as additive until your tests show otherwise. Pin the package version and check the existing cnpj rule plus any custom validation extensions that wrap or override it.
- What Laravel and PHP versions does geekcom/validator-docs support?
- The context does not list exact Laravel and PHP constraints for version 3.12.0. Check the package composer.json and README before upgrading, then run your application test suite on your target Laravel and PHP versions. This matters because community packages can introduce dependency conflicts during framework upgrades.
- Does geekcom/validator-docs validate formatted and unformatted Brazilian documents?
- The package validates Brazilian document types including CPF, CNPJ, CNH, NIS, DDD, Título Eleitoral, and CNS. The context does not detail every input-format edge case, so add tests for formatted and unformatted values in your forms and APIs. For alphanumeric CNPJ, include invalid check-digit cases as well.
- How should I test the alphanumeric CNPJ upgrade before production?
- Upgrade in a non-production branch to Composer constraint ^3.12, run regression tests for all existing document validations, and add unit and feature tests for alphanumeric CNPJ. Cover formatted and unformatted input plus invalid check digits, then update frontend masks and API contracts. Release behind normal deployment controls and monitor validation failures.
- What are the production risks of using geekcom/validator-docs?
- The main risks are false validation results if the alphanumeric CNPJ check-digit algorithm is incorrect, legacy systems rejecting letter-containing CNPJ values, frontend masks that assume numeric-only input, and dependency conflicts during Laravel upgrades. The package is small and CPU-light, so scaling impact is negligible. Keep version pinning and an internal fallback validation rule for business-critical flows.
- Can geekcom/validator-docs generate documentation for my Laravel validation rules?
- Yes, the package includes a simple Artisan command that scans application rules and outputs clean Markdown tables with each rule, its parameters, and descriptions. This helps keep validation documentation in sync with code. Run it as part of your documentation workflow or CI checks.
- How is geekcom/validator-docs maintained and what alternatives exist?
- It is a focused community-maintained Laravel package, so version pinning and periodic dependency review are advisable. Support relies on the package issue tracker and README, with an internal fallback rule if alphanumeric CNPJ becomes business-critical. Alternatives include maintaining custom Laravel validation rules or using other Brazilian document validation packages, but evaluate their CNPJ transition support and maintenance activity.