Package

Intervention Validation

Additional validation rules for the Laravel framework

Package

intervention/validation

View on GitHub →

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.

Intervention Validation Related Articles

Intervention Validation image

Intervention Validation

Read article
Laravel Validation: A Practical Guide with Examples image

Laravel Validation: A Practical Guide with Examples

Read article
Intervention Image image

Intervention Image

Read article
Stargazing in Your Laravel App with Intervention Zodiac image

Stargazing in Your Laravel App with Intervention Zodiac

Read article
Intervention Image v2 is released image

Intervention Image v2 is released

Read article
Testing Length Validation in Laravel image

Testing Length Validation in Laravel

Read article

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm

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

Let your users buy domains without leaving your app

If your Laravel app gives users a site, a storefront, or a workspace, they’ll eventually want their own domain. The name.com API lets them search, register, and connect one without leaving your product. It’s a clean REST API, so Laravel’s HTTP client is all you need.

Let your users buy domains without leaving your app

Shift

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

Shift

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

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum