proengsoft / laravel-jsvalidation
Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest
Fund package maintenance!
bytestream
Installs: 1 904 424
Dependents: 56
Suggesters: 0
Security: 0
Stars: 1 134
Watchers: 32
Forks: 175
Open Issues: 21
Requires
- php: ^8.0
- illuminate/config: ^9.0|^10.0|^11.0
- illuminate/contracts: ^9.0|^10.0|^11.0
- illuminate/http: ^9.0|^10.0|^11.0
- illuminate/support: ^9.0|^10.0|^11.0
- illuminate/translation: ^9.0|^10.0|^11.0
- illuminate/validation: ^9.0|^10.0|^11.0
- illuminate/view: ^9.0|^10.0|^11.0
- symfony/http-foundation: ^6.0|^7.0
Requires (Dev)
- mockery/mockery: ^1.0
- orchestra/testbench: ^7.0|^8.0|^9.0
- phpunit/phpunit: ^9.5|^10.0
- dev-master
- v4.9.3
- v4.9.2
- v4.9.1
- v4.9.0
- v4.8.1
- v4.8.0
- v4.7.6
- v4.7.5
- v4.7.4
- v4.7.3
- v4.7.2
- v4.7.1
- v4.7.0
- v4.6.1
- v4.6.0
- v4.5.1
- v4.5.0
- v4.4.7
- v4.4.6
- v4.4.5
- v4.4.4
- v4.4.3
- v4.4.2
- v4.4.1
- 4.4.0
- 4.3.1
- 4.3.0
- 4.2.0
- 4.1.0
- 4.0.0
- 3.0.1
- 3.0.0
- 2.5.0
- 2.4.0
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.0
- v2.0.0
- v1.5.0
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.1
- v1.3.0
- v1.2.0
- v1.2.0rc1
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-rc1
- dev-bytestream-patch-1
- dev-dependabot/npm_and_yarn/dev-dependencies-8c546a82a9
- dev-dependabot/npm_and_yarn/del-8.0.0
- dev-dependabot/npm_and_yarn/babel-loader-9.2.1
- dev-dependabot/npm_and_yarn/webpack-5.94.0
- dev-dependabot/npm_and_yarn/bundlewatch-0.4.0
- dev-dependabot/composer/phpunit/phpunit-tw-9.5tw-10.0tw-11.0
This package is auto-updated.
Last update: 2024-11-26 15:57:45 UTC
README
Laravel Javascript Validation package allows to reuse your Laravel Validation Rules, Messages, FormRequest and Validators to validate forms automatically in client side without need to write any Javascript code or use HTML Builder Class.
You can validate forms automatically referencing it to your defined validations. The messages are loaded from your validations and translated according your Localization preferences.
Supported versions
Laravel 9.x - 11.x
Feature overview
- Automatic creation of Javascript validation based on your Validation Rules or FormRequest, no Javascript coding required.
- Supports other validation packages.
- AJAX validation for ActiveURL, Unique and Exists Rules, Custom Validation Rules and other validation packages
- Unobtrusive integration, you can use without Laravel Form Builder
- The package uses Jquery Validation Plugin bundled in provided script.
- Uses Laravel Localization to translate messages.
Supported Rules
Almost all Validation Rules provided by Laravel and other packages are supported.
Almost are validated in client-side using Javascript, but in some cases, the validation should to be done in server-side via AJAX:
- ActiveURL
- Unique
- Exists
- Custom Validation Rules
- Validations provided by other packages
Unsupported Rules
Some Laravel validations are not implemented yet.
- Present
- DateFormat rule don't support timezone format
Getting started
The easiest way to create Javascript validations is using Laravel Form Request Validation.
Installation
Follow the Installation Guide to install the package. The default config should work out-of-box
Validating Form Request
Call JsValidator Facade in your view to validate any FormRequest
<form> <!-- ... My form stuff ... --> </form> <!-- Javascript Requirements --> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/js/bootstrap.min.js"></script> <!-- Laravel Javascript Validation --> <script type="text/javascript" src="{{ asset('vendor/jsvalidation/js/jsvalidation.js')}}"></script> {!! JsValidator::formRequest('App\Http\Requests\MyFormRequest') !!}
Take a look to Basic Usage or Examples to get more information.
Documentation
To get more info refer to Project Wiki
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
Laravel Javascript Validation contributors list
License
The MIT License (MIT). Please see License File for more information.