- How do I validate a Polish ID card number in Laravel?
- Use the package validator to check the 9-character format and official weighted checksum, then call it from a Laravel custom validation rule. The package returns a clear boolean, so your rule can return true or false and attach an error message such as Invalid Polish ID card number. Keep the validation call in a dedicated rule class so controllers and form requests stay clean.
- How do I install the Polish ID card number validator with Composer?
- Install it with Composer using composer require pajerdesign/polish-id-card-number-validator-bundle. Composer will register the package autoloader for Laravel or standalone PHP usage. Check the repository README for the exact validator class name and the usage example for your installed version.
- Does this package verify the checksum or only the format?
- It does both. The package confirms the three-letter plus six-digit structure and verifies the control digit with the official weighted checksum using weights 7, 3, 1, 9, 7, 3, 1, 7, 3. Letter-series characters are mapped correctly with A=10, B=11, and so on, so checksum validation works for real ID numbers rather than only regex-shaped strings.
- What format does a Polish ID card number use?
- A Polish ID card number, or numer dowodu osobistego, is 9 characters long: a three-letter series followed by six digits. The validator rejects wrong length, invalid characters, and bad control digits. The package description targets the canonical 9-character format, so normalize input with trim and uppercase if your forms allow lowercase or spaces.
- Can I use this Polish ID validator outside Laravel?
- Yes. It is a lightweight, dependency-free PHP package, so you can use it in plain PHP scripts or any Composer-based project. In Laravel you would usually wrap it in a custom validation rule, but the underlying validator returns a simple boolean and does not require the framework.
- How do I create a Laravel validation rule for Polish ID card numbers?
- Create a custom rule class that calls the package validator with the submitted ID number and returns its boolean result. Add that rule to your FormRequest rules array and provide a clear validation message. If your form accepts lowercase letters or spaces, normalize the value before passing it to the validator.
- Which Laravel versions does this package support?
- The package is dependency-free, so Laravel compatibility mainly depends on your PHP version and Composer constraints rather than a hard Laravel version lock. Check the package's composer.json and README for the supported PHP range, then run your test suite on the Laravel version you deploy. When wrapped in a custom rule, the integration is usually stable across modern Laravel releases.
- Is this package maintained and safe for production?
- It is a focused validation helper rather than a full identity verification service. Use it to catch malformed or mistyped Polish ID numbers before they reach your domain logic, and combine it with your own KYC checks where required. Its small, dependency-free design makes it easy to test and review for production use, but you should still confirm the package's current maintenance status and release history on the repository.
- What alternatives are there to this Polish ID validator?
- A regex can check the three-letter plus six-digit shape, but it cannot verify the control digit. You could implement the official weighted checksum yourself, or use this package to avoid duplicating the A=10 mapping and weights 7, 3, 1, 9, 7, 3, 1, 7, 3. For Laravel projects, wrapping a dedicated validator in a custom rule is usually cleaner than embedding checksum logic in controllers.
- How should I test Polish ID card validation in Laravel?
- Write unit or feature tests that pass known-valid 9-character ID numbers and known-invalid values such as wrong length, invalid characters, and bad control digits. Assert that your custom Laravel rule accepts valid input and adds the expected error for invalid input. Keep a small fixture set of valid and invalid numbers so checksum regressions are caught when dependencies or rules change.