Jump24 - Laravel Developers that Click into Place. Never outsourced. Never offshored. Always exceptional.

Validation

intervention/validation image

Validation stats

Downloads
3M
Stars
454
Open Issues
5
Forks
61

View on GitHub →

Additional validation rules for the Laravel framework

Intervention Validation Package for Laravel

Intervention Validation enhances Laravel's built-in validation system by introducing over 30 additional validation rules. These rules extend the capability to validate sophisticated data types such as IBAN, ISBN, credit card numbers, and various coding and formatting standards.

Key Features:

  • Extended Validation Rules: Adds robust validation for data types like credit cards, colors in hexadecimal, usernames, and more, ensuring data integrity and compliance with international standards.
  • Integration with Laravel: Seamlessly integrates with Laravel (version 7 and above), leveraging its automatic service provider discovery system for easy setup.
  • Customizable Error Messages: Customize validation error messages either directly within the validator or by modifying language files.
  • Standalone Usage: Use outside of Laravel with a dedicated Intervention\Validation\Validator for applications not based on Laravel.

Installation:

Install via Composer with the command:

composer require intervention/validation

Usage Example:

use Illuminate\Support\Facades\Validator;
use Intervention\Validation\Rules\HexColor;
use Intervention\Validation\Rules\Creditcard;
 
$validator = Validator::make($request->all(), [
'color' => new HexColor(),
'number' => 'required|creditcard',
]);

Standalone Example:

use Intervention\Validation\Validator;
use Intervention\Validation\Rules\Creditcard;
 
$validator = Validator::make($request->all(), [
'ccnumber' => new Creditcard(),
]);
 
$result = Validator::isHexcolor('#ccc'); // returns true

Notable Validation Rules:

  • Creditcard: Validates various credit card numbers.
  • HexColor: Validates colors in hexadecimal format.
  • IBAN: Validates International Bank Account Numbers.
  • ISBN: Validates International Standard Book Numbers, supporting both ISBN-10 and ISBN-13.
  • Username: Validates usernames with specific character requirements.

Development & Testing:

Included is a Docker configuration for running tests, which requires Docker to be installed:

docker-compose run --rm --build tests

Intervention Validation stands out by providing extensive additional validation rules that are easy to integrate and use within Laravel, enhancing both the robustness of your data validation processes and the security of your applications.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.


Intervention Validation Related Articles

Intervention Validation image

Intervention Validation

Read article
Laravel ImageUp image

Laravel ImageUp

Read article
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing