vincentkos / blur-validation
Easy to use server side blur validation
Requires
- php: ^7.4|^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^9.0
README
Using this package you can easily validation form with instant feedback without writing any javascript.
Installation
You can install the package via composer:
composer require vincentkos/blur-validation
You need to publish the javascript using :
php artisan vendor:publish --provider="Vincentkos\BlurValidation\BlurValidationServiceProvider" --tag="blur-validation"
Usage
For this package to work you need to have a meta tag with the name csrf-token
and a content
attribute with the current csrf token.
<meta name="csrf-token" content="{{ csrf_token() }}" />
Then you can start validating your form using the validation:rules
attribute and validation:error
like this :
<div> <label for="email">Email address:</label> <input type="text" name="email" id="email" validate:rules="required|email|unique:users"> <span validate:error="email"></span> </div>
When the user leave the input
the validation will be trigger and if an error is returned it will be written inside the span
. Errors are displayed in the first matching tag and it's always the first error returned.
If you need to integrate this package with other tools such as alpine, react, lit etc ... you should use the blur-validation.validate
without including the javascript.
Limitation
- In it's current state this package cannot hide or show the error tag, this limitation is due to the fact that I don't need it right now but PR are welcome if you want to implement this.
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.