danielmrdev/laravel-spanish-validator
Validator::make(), Form Requests), leveraging Laravel’s existing Rule and Validator abstractions. This ensures consistency with the framework’s architecture and avoids reinventing validation logic.SpanishValidatorServiceProvider.composer require installation with zero configuration for basic usage, though customization (e.g., rule overrides) may require minor adjustments.ES).TRW checks)?rules() method (e.g., 'nif' => 'spanish_nif').ApiResource or DTO validation layers.creating).composer.json and publish the package.spanish_nif, spanish_iban).SpanishValidatorTest).composer.json dependencies.Illuminate\Contracts\Validation\Rule interface.| Phase | Task | Dependencies |
|---|---|---|
| 1. Assessment | Audit current validation logic. | None |
| 2. Setup | Install package, configure service provider. | Composer access |
| 3. Pilot | Replace one validator (e.g., NIF) in a test module. | Audit results |
| 4. Testing | Write project-specific tests for edge cases. | Pilot results |
| 5. Rollout | Update all validation points. | Test coverage |
| 6. Monitoring | Log validation failures (e.g., NIE rejections) for 30 days. | Production deployment |
VALIDATION_RULES.md.Validator::extend() to add project-specific rules if needed.00000000T is technically invalid but may be used in legacy systems).ES prefix missing).spanish_nif:legacy_format).laravel-debugbar.ValidationJob.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package Abandons Maintenance | Broken rules in future Laravel versions. | Fork the repo or switch to a maintained alternative (e.g., spatie/laravel-validation-extensions). |
| False Validations | Invalid NIF/NIE slips through. | Implement a secondary check (e.g., API call to Agencia Tributaria). |
| Regulatory Changes | New NIF format not supported. | Subscribe to Spanish tax authority updates; patch locally. |
| Dependency Vulnerabilities | Underlying PHP/Laravel libs have CVEs. | Monitor composer audit; update dependencies. |
spanish_nif, spanish_iban, etc.dd($errors->first('nif'))).How can I help you explore Laravel packages today?