Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Fr Validator

Fr Validator Laravel Package

petroslabs/fr-validator

A Laravel/PHP validation package for French data formats. It provides ready-made rules that integrate with Laravel’s validator, helping you validate common French identifiers and fields cleanly in forms, APIs, and application requests.

Deep Wiki
Context7

petroslabs/fr-validator adds French-specific validation rules to Laravel’s validator, making it easy to validate common French business and identity data without custom regex or external services. It integrates with standard Laravel validation workflows, including form requests and inline rules.

  • SIRET/SIREN checksum validation
  • French VAT (TVA) number rules
  • Postal codes and phone numbers
  • IBAN/RIB validation
  • Laravel-native rules with clear error messages
Frequently asked questions about Fr Validator
What French identifiers can I validate with petroslabs/fr-validator?
The package provides validators for common French business and identity identifiers, including SIRET, SIREN, VAT numbers, NIR (numéro de sécurité sociale), RIB, IBAN, postal codes and phone numbers. It is described as framework-agnostic, so the underlying validator logic is not tied to Laravel, while the package also adds Laravel-friendly validation rules. Check the README for the exact rule names and method signatures exposed by each validator.
How do I install petroslabs/fr-validator in a Laravel project?
Install it with Composer using composer require petroslabs/fr-validator. Laravel packages that ship a service provider are usually registered automatically through package discovery, but if yours is not, add the provider to your bootstrap or config/app.php providers list. Consult the README for any publishable config or translation files that should be exported.
How do I use these French validation rules inside a Laravel FormRequest?
Add the package's rule names to the rules array of your FormRequest or inline validator, for example 'siret' => ['required', 'siret'] alongside your other constraints. Because they behave like standard Laravel rules, they work with validate(), FormRequest classes, and the Validator facade. Confirm the exact rule identifiers in the README, since rule strings must match what the package registers.
Can I use petroslabs/fr-validator outside of Laravel?
Yes. The package is described as framework-agnostic, meaning the core validators can be instantiated and called directly from any PHP codebase, including Symfony, plain PHP scripts, or CLI tools. The Laravel rule integration is a thin convenience layer on top of those validators, so you can reuse the same checks in non-Laravel services. Refer to the README for the standalone usage examples.
Which Laravel and PHP versions does petroslabs/fr-validator support?
The authoritative source is the require section of the package's composer.json and the compatibility notes in the README. Check those before upgrading Laravel or PHP in your application, since major framework releases occasionally change validation internals. If your project pins an older Laravel version, run a quick Composer dry-run to confirm the constraints resolve.
Does it check the checksum of SIRET, SIREN and IBAN, or only the format?
Dedicated French identifier validators normally go beyond a simple regex and verify the mathematical check digits, such as the Luhn algorithm for SIRET and SIREN and the mod-97 check for IBAN. The package's purpose is validating real identifiers rather than just their shape, but you should confirm the specific algorithm covered for each type in the README or test suite. If a particular identifier type is only format-checked, combine it with your own business verification step.
How should I handle NIR (French social security number) input before validating it?
Normalize the input first, because users often type NIR with spaces, dots, or hyphens, and the validator may expect a raw digit string plus the two-digit key. Trim and strip separators, then validate, and be aware that NIR can legitimately contain 2A or 2B department codes for Corsica. NIR is sensitive personal data, so store and log it carefully and check the README for the expected input format.
Can I customize the validation error messages returned by these French rules?
In Laravel you can override messages per rule in a FormRequest's messages() method or by publishing and editing the package translation files if it ships them. For framework-agnostic usage, the validator typically returns or exposes its own error descriptions that you can map to your own response format. Keep messages user-facing and translated to French if the form is for French end users.
Is petroslabs/fr-validator safe and reliable enough for production use?
These validators are pure validation logic and generally do not call external services, which keeps them fast and predictable in production. Pin the package to a specific version in composer.json, run your own test suite against representative valid and invalid French identifiers, and review the changelog before updating. Remember that passing validation only proves the identifier is well-formed, not that the company or account actually exists.
When should I use this package instead of writing my own regex validation rules?
Use it when you need correct check-digit handling for SIRET, SIREN, NIR, RIB or IBAN, since hand-rolled regexes frequently miss checksum and edge-case rules. A maintained package also saves you from re-testing French identifier formats across every project. If you only need a loose format check on one field, a simple Laravel regex rule may be sufficient, but for business-critical French data the dedicated validators are usually the safer choice.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
frankyso/ipaymu
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core