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

RouteKey Model Attribute in Laravel 13.21 image

RouteKey Model Attribute in Laravel 13.21

Read article
Intervention Validation image

Intervention Validation

Read article
Laravel ImageUp image

Laravel ImageUp

Read article
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
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Tinkerwell logo

Tinkerwell

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

Tinkerwell
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
Blastup logo

Blastup

Blastup provides social media enhancement services including buying Instagram likes, followers, and views, with features like instant delivery and a variety of packages to suit different needs.

Blastup
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud