vincentkos/blur-validation

This package is abandoned and no longer maintained. No replacement package was suggested.

Easy to use server side blur validation

1.0.0 2021-08-22 20:52 UTC

This package is auto-updated.

Last update: 2021-12-22 21:44:37 UTC


README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.