Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

respect/validation 2.3.2

The most awesome validation engine ever created for PHP
Package summary
Share
0
issues
0
licenses
Package created
16 Jan 2012
Version published
2 Feb 2024
Maintainers
2
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does respect/validation do?

The Respect/Validation is a remarkable validation engine specifically designed for PHP. It is equipped with an arsenal of over 150 fully tested validation rules. Respect/Validation allows the creation of complex rules, effectively simplifying tasks such as validating numerical, positive values between 1 to 255. It is also equipped with granularity control for improved reporting and a concrete API for non-fluent usage.

How do you use respect/validation?

Using Respect/Validation in your PHP scripts is quite a straightforward process. First, you need to install it via Composer. You can do that by running the following command:

composer require respect/validation

Once installed, you can use it in your scripts. For example, to validate if an input is a positive number that falls between 1 to 255:

require 'vendor/autoload.php';

use Respect\Validation\Validator as v;

$input = 123;

$validation = v::numericVal()->positive()->between(1, 255)->validate($input); 

if ($validation){
    echo "Input is valid!";
} else {
    echo "Invalid input.";
}

In this code snippet, we're requiring the Composer's autoloader, then using the Respect\Validation\Validator class. We created a rule that checks if $input is a numeric value, which is also positive and falls between 1 and 255.

Where are the respect/validation docs?

For more in-depth information and tutorials, you can find the comprehensive Respect/Validation documentation on readthedocs. It provides a detailed guide on how to use the more than 150 validation rules, explains how to contribute to the project, and more.