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

laminas/laminas-validator 2.53.0

Validation classes for a wide range of domains, and the ability to chain validators to create complex validation criteria
Package summary
Share
0
issues
0
licenses
Package created
1 Jan 2020
Version published
1 Apr 2024
Maintainers
1
Total deps
0
Direct deps
0
License
BSD-3-Clause
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does laminas/laminas-validator do?

The laminas/laminas-validator is a powerful PHP package designed for data validation. It offers a vast selection of validation classes that can be utilized across a wide range of domains. One of its distinct features is the ability to chain validators. This enables the creation of complex validation criteria by applying multiple validators to a single piece of data in a specific, user-defined sequence.

How do you use laminas/laminas-validator?

You can incorporate the laminas/laminas-validator into your PHP project using composer, a popular package manager used for PHP. You should first ensure that you have composer installed and ready to go. Next, run the following command in your terminal:

$ composer require laminas/laminas-validator

After successfully installing the laminas/laminas-validator, you can utilize its functionalities in your PHP files by invoking the validators it provides.

Here's a simple example:

use Laminas\Validator;

$validatorChain = new Validator\ValidatorChain();

$validatorChain->attach(new Validator\StringLength(array('min' => 6, 'max' => 12)))
               ->attach(new Validator\Regex(array('pattern' => '/[a-zA-Z0-9_-]+$/')));

$isValid = $validatorChain->isValid($value); // returns boolean

In the above example, we first import the required Laminas Validator classes. Next, we create a ValidatorChain instance and attach two validators: StringLength and Regex to it. Finally, we check if a value is valid according to the chained validators.

Where are the laminas/laminas-validator docs?

The comprehensive documentation of the laminas/laminas-validator can be browsed online at https://docs.laminas.dev/laminas-validator/. The documentation provides in-depth information on various validators available in the package, and details on how to use them, making it an invaluable guide to effectively utilize the powerful functionalities of laminas/laminas-validator.