Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

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
Typesense Search logo

Typesense Search

Typesense is an open source, blazing-fast search engine, optimized for helping you build delightful search experiences for your sites and apps. Natively integrated with Laravel Scout.

Typesense Search
Tinkerwell logo

Tinkerwell

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

Tinkerwell
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Tighten logo

Tighten

We help companies turn great ideas into amazing apps, products, and services.

Tighten
Curotec logo

Curotec

World class Laravel experts with GenAI dev skills. LATAM-based, embedded engineers that ship fast, communicate clearly, and elevate your product. No bloat, no BS.

Curotec
DreamzTech logo

DreamzTech

Hire 6-10+ Yrs. experienced skilled Laravel Developers from DreamzTech. We ensure NDA protected, 100% quality delivery. Contact Us & Discuss Your Need.

DreamzTech