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 required. Built on jQuery Validation with localization support, plus AJAX validation for unique/exists/active_url and custom rules. Supports Laravel 11–13, PHP 8.2–8.4.

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 do I integrate this package into an existing Laravel project using FormRequest validation?
Install via Composer (`composer require proengsoft/laravel-jsvalidation`), publish the config if needed, then call `JsValidator::formRequest('YourFormRequest')` in your Blade template. The package auto-generates client-side validation rules matching your server-side FormRequest logic, including error messages and localization.
Does this package support Laravel 13 and PHP 8.4?
Yes, the package officially supports Laravel 11–13 and PHP 8.2–8.4. Check the [GitHub releases](https://github.com/proengsoft/laravel-jsvalidation/releases) for the latest compatibility updates. Always test in a staging environment before upgrading.
What happens if a user submits a form with client-side validation disabled?
The package relies on client-side validation for UX but falls back to server-side validation for security. If JavaScript is disabled, the form will still validate on the server using your existing Laravel validation logic (e.g., FormRequest). No additional configuration is needed.
Can I use this package with Vue.js or React without jQuery?
The package depends on jQuery Validation Plugin (v1.19.x), so it’s not ideal for modern SPAs. For Vue/React, consider alternatives like `vee-validate` or `laravel-vue-validation`. However, you can still use this package for traditional Laravel Blade forms while keeping SPAs separate.
How do I handle AJAX validation errors (e.g., unique field conflicts) gracefully?
The package automatically handles AJAX errors for rules like `unique`, `exists`, and custom rules by triggering server-side checks. For better UX, add loading states (e.g., disable submit buttons) and handle errors via the jQuery Validation Plugin’s `errorPlacement` or `showErrors` callbacks. Example: `$(form).validate({ onfocusout: false, onsubmit: false });`.
Are there performance concerns with auto-generating JS validation scripts?
The generated JS validation scripts are lightweight and only include rules defined in your FormRequest. For large forms, consider lazy-loading the validation script or using tree-shaking if bundling with Webpack/Vite. Test with tools like Lighthouse to measure impact.
What if a custom validation rule isn’t supported client-side?
Unsupported rules (e.g., `present`, `dateFormat` with timezones) will trigger server-side validation via AJAX. You can extend the package by adding custom JavaScript rules or use the `JsValidator::make()` method to manually define client-side rules for unsupported cases.
How do I localize validation error messages for non-English forms?
The package inherits Laravel’s localization system. Ensure your `resources/lang/` folders contain translated validation messages (e.g., `validation.php`). The client-side messages will automatically match your server-side translations. Test with `php artisan lang:publish` if messages are missing.
Can I use this package with third-party validation packages like `spatie/laravel-validation-extensions`?
Yes, the package supports third-party validation rules if they’re compatible with Laravel’s core validation system. Rules like `spatie/laravel-permission` or `laravel-validation-extensions` will work client-side if they’re implemented in JavaScript or via AJAX. Check the [supported rules list](https://github.com/proengsoft/laravel-jsvalidation#supported-rules) for updates.
What’s the best way to test client-side validation in CI/CD?
Test client-side validation by running JavaScript unit tests (e.g., with Jest or Karma) for custom rules and end-to-end tests (e.g., Cypress or Laravel Dusk) to simulate form submissions. Mock AJAX responses for rules like `unique` to avoid flaky tests. Example: `axios.mockResponse({ errors: { email: ['The email is already taken.'] } });`.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai