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
Laravel Jsvalidation

Laravel Jsvalidation Laravel Package

proengsoft/laravel-jsvalidation

Reuse Laravel validation rules, messages, and FormRequests for automatic client-side form validation—no custom JS needed. Built on jQuery Validation, supports localization and most rules, with AJAX checks for unique/exists/active_url and custom rules.

View on GitHub
Deep Wiki
Context7

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

Frequently asked questions about Laravel Jsvalidation
How does this package sync Laravel validation rules with client-side JavaScript validation?
The package automatically generates client-side validation logic by parsing your Laravel validation rules (from FormRequests or manual definitions) and translating them into jQuery Validation Plugin syntax. Error messages are pulled from Laravel’s localization system, ensuring consistency between frontend and backend.
Can I use this with Laravel FormRequests or do I need to define rules manually?
You can use it seamlessly with Laravel FormRequests—just call the `JsValidator` facade in your view to auto-generate client-side validation. Manual rule definitions also work but require additional configuration to map them to the package’s validation system.
Does this package support custom validation rules or third-party packages like Spatie’s validation?
Yes, it supports custom validation rules and third-party packages. Rules like `unique`, `exists`, and custom rules are handled via AJAX to ensure server-side validation when needed. Check the [supported rules list](https://github.com/proengsoft/laravel-jsvalidation) for compatibility.
Will this work with modern frontend frameworks like Vue, React, or Alpine.js?
Technically yes, as long as jQuery is included in your project. However, the package is built on jQuery Validation, so integration with modern SPAs may require additional effort (e.g., mounting the validator manually). For lightweight projects, consider alternatives like Laravel Livewire or custom solutions.
What Laravel and PHP versions are supported, and is there backward compatibility?
The package supports Laravel 11–13 and PHP 8.2–8.4. It’s designed for modern Laravel versions, so older projects (e.g., Laravel 10 or PHP 8.1) may require adjustments or forking. Always test thoroughly after upgrading Laravel or PHP.
How does AJAX validation work for rules like `unique` or `exists`? Does it add latency?
AJAX validation checks server-side rules (e.g., `unique`, `exists`) by calling Laravel endpoints when the user interacts with the form. While this adds minor latency, the package optimizes performance by caching responses and only validating when necessary. Test under load to ensure responsiveness.
Are there any validation rules that *aren’t* supported client-side, and how do I handle them?
Rules like `present`, timezone-aware `dateFormat`, and some custom rules lack client-side implementations. These fall back to server-side validation. Design your forms to handle these cases gracefully, or extend the package to support missing rules via custom JavaScript.
How do I test client-side validation to ensure it matches server-side rules?
Test client-side validation by writing unit tests for your JavaScript rules (using tools like Jest or Laravel Dusk) and integration tests for AJAX fallbacks. Compare error messages and validation logic between frontend and backend to catch discrepancies early.
Is jQuery a hard dependency? Can I avoid it if I’m not using it elsewhere?
Yes, jQuery is a hard dependency as the package relies on the jQuery Validation Plugin. If your project doesn’t already use jQuery, adding it may increase bundle size or conflict with modern build tools (e.g., Vite). Weigh the trade-offs against alternatives like Laravel Livewire or custom validation libraries.
What are the alternatives to this package, and when should I consider them?
Alternatives include Laravel Livewire (for real-time validation), custom JavaScript libraries (e.g., Vue Formulate), or packages like `laravel-nova-validation`. Choose this package if you prioritize reusing Laravel’s validation logic with minimal JS effort. Opt for alternatives if you need lighter weight, better SPA support, or more granular control.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation