Weave Code
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
Persian Validation

Persian Validation Laravel Package

farbodtf/persian-validation

View on GitHub
Deep Wiki
Context7

پکیج اعتبارسنجی فارسی برای لاراول - ترجمه پیام‌های خطای اعتبارسنجی به فارسی

Frequently asked questions about Persian Validation
How do I install and enable Persian validation messages in Laravel?
Run `composer require farbodtf/persian-validation`, then publish the language file with `php artisan vendor:publish --tag=persian-validation-lang`. Override default messages in `resources/lang/fa/validation.php` if needed. No additional configuration is required for basic usage.
Does this package work with Laravel 9/10 or only older versions?
The package is designed for Laravel 8+ and is fully compatible with Laravel 9 and 10. Check the `composer.json` for exact version requirements, but it follows Laravel’s validation system, which remains stable across these versions.
Will this break existing validation rules or custom rules in my app?
No, it won’t break existing rules. The package only localizes error messages for built-in Laravel validation rules. For custom rules, you’ll need to explicitly extend them to support Persian messages using the `extends` method or merge them with the package’s language file.
How do I handle dynamic locale switching (e.g., user selects Persian or English)?
Use Laravel’s built-in locale middleware (`app/Http/Middleware/SetLocale`) to switch locales dynamically. The package automatically picks up the current locale, so no extra code is needed unless you’re using custom validation logic that bypasses the default flow.
Can I use this with third-party validation packages like `laravel-validator`?
Third-party validation rules may not be included by default. Test thoroughly after installation. If a rule is missing, manually add its Persian messages to `resources/lang/fa/validation.php` or extend the rule to support localization.
Does this package support nested validation arrays or conditional rules?
Yes, it supports all standard Laravel validation scenarios, including nested arrays and conditional rules. The localized messages will appear correctly as long as the validation logic remains unchanged—only the error messages are translated.
How do I test that Persian validation messages are working correctly?
Write unit tests using Laravel’s `ValidationException` or `Validator` facade. Assert that error messages are in Persian by triggering validation failures (e.g., `Validator::make(['email' => 'invalid'], ['email' => 'required'])->errors()->first()`). Test edge cases like nested arrays and custom rules.
Is there a performance impact when using this package in production?
No, the package adds negligible overhead. It only injects localized messages during validation, which is a lightweight operation. Even in high-traffic applications, the impact should be minimal, but benchmark if you’re serving millions of requests per second.
Can I extend this package to support other languages in the future?
Yes, the package is designed for easy extension. You can create additional language files (e.g., `resources/lang/ar/validation.php` for Arabic) and follow the same pattern. The architecture is modular, so adding more languages requires minimal effort.
What if I need to customize Persian error messages beyond the defaults?
Override the default messages by editing `resources/lang/fa/validation.php`. The package provides a fallback to Laravel’s default messages, so you can modify only the messages you need. For dynamic customization, use Laravel’s `Validator::extend` to inject custom logic.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle