PHPackages                             juanchosl/validators - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. juanchosl/validators

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

juanchosl/validators
====================

Little methods collection in order to validate variables contents

1.0.8(4mo ago)13144MITPHPPHP ^8.1

Since Mar 4Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/JuanchoSL/Validators)[ Packagist](https://packagist.org/packages/juanchosl/validators)[ Docs](https://github.com/JuanchoSL/Validators)[ RSS](/packages/juanchosl-validators/feed)WikiDiscussions 1.0 Synced 1mo ago

READMEChangelog (9)Dependencies (2)Versions (11)Used By (4)

Validators
==========

[](#validators)

Description
-----------

[](#description)

Little methods collection in order to validate variables contents

Install
-------

[](#install)

```
composer require juanchosl/validators
composer update
```

How to use
----------

[](#how-to-use)

### Validation availability

[](#validation-availability)

- Strings
- General numbers
- Specific integers
- Specific floats
- Entity iterable, as objects or assoc arrays
- General Iterables, as indexed arrays or recursive validations
- Primitive boolean, reals or equivalents and Null checking

### Single validation

[](#single-validation)

You can perform an only check over a single value

```
StringValidation::isEmail("juanchosl@hotmail.com"); //true
```

### Multiple validations over 1 value

[](#multiple-validations-over-1-value)

You can perform a few checks over a single value

```
$validator = new StringValidations();
$validator
    ->is()
    ->isNotEmpty()
    ->isLengthGreatherThan(15)
    ->isEmail();

$validator->getResult('juanchosl@hotmail.com'); //true

print_r($validator->getResults('juanchosl@hotmail.com'));
Array
(
    [is] => 1
    [isNotEmpty] => 1
    [isLengthGreatherThan: 15] => 1
    [isEmail] => 1
)
```

### Multiple validations over multiple values

[](#multiple-validations-over-multiple-values)

You can perform a few checks over multiple values

```
$validator = new StringValidations();
$validator
    ->is()
    ->isNotEmpty()
    ->isLengthGreatherThan(15)
    ->isEmail();

    foreach(['juanchosl@hotmail.com', 'email@corporation.com'] as $text){
        $validator->getResult($text); //true

        print_r($validator->getResults($text));
        Array
        (
            [is] => 1
            [isNotEmpty] => 1
            [isLengthGreatherThan: 15] => 1
            [isEmail] => 1
        )
    }
```

### Alternative validations (OR) over values

[](#alternative-validations-or-over-values)

You can perform some alternative checks over the values in order to accept it if pass ANY of some condicions

```
$validator = new StringValidations();
$validator
    ->is()
    ->isNotEmpty()
    ->isValueEqualsAny('juan','pepe','antonio')
    ->getResult('juan'); //true
```

### Validations over associative arrays or entities

[](#validations-over-associative-arrays-or-entities)

You can perform checks over the values of an associative array or object, can be simple validations or any other complex validation, indicating the target index. The results of the validations are unitary, for each element

```
$datas = [
    ["nombre" => "pepe", "apellidos" => "salmuera", "email" => "aaaa@bbb.com", "telephone" => 123456789],
    ["nombre" => "juan", "apellidos" => "benito", "email" => "bbb@ccc.es", "telephone" => 123456789],
];
$validator = new EntityValidations();
$validator->isValueAttributeValidating('email', (new StringValidations())->isEmail());
$validator->isValueAttributeValidating('telephone', (new IntegerValidations())->isLengthGreatherOrEqualsThan(9)->isLengthLessOrEqualsThan(12));

foreach($datas as $data){
    $validator->getResult($data);
}
```

### Validations over iterables

[](#validations-over-iterables)

Instead of iterate over a collection, as the previous example, you can perform checks over the keys or values of an iterable, can be simple validations or any other complex validation

```
$validator = new IterableValidations();
$validator
    ->is()
    ->isNotEmpty()
    ->isKeyContainingAny(...['nombre', 'apellidos']);
    ->getResult(['nombre' => 'Cadena numeros', 'apellidos' => 'Cadena letras']);//true

***********

$datas = [
    ["nombre" => "pepe", "apellidos" => "salmuera", "email" => "aaaa@bbb.com", "telephone" => 123456789],
    ["nombre" => "juan", "apellidos" => "benito", "email" => "bbb@ccc.es", "telephone" => 123456789],
];
$validator->isValueAttributeValidating('email', (new StringValidations())->isEmail());
$validator->isValueAttributeValidating('telephone', (new IntegerValidations())->isLengthGreatherOrEqualsThan(9)->isLengthLessOrEqualsThan(12));

$validator->getResult($datas);
************

$datas = ["aaaa@bbb.com", "bbb@ccc.es"];
$validator = new IterableValidations();
$validator->isValueValidating((new StringValidations())->isEmail());
$validator->getResult($datas);
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance76

Regular maintenance activity

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~75 days

Recently: every ~58 days

Total

10

Last Release

125d ago

PHP version history (3 changes)1.0.0PHP ^7.1 || ^8.0

1.0.6PHP ^8.0

1.0.8PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/bd6d3dea7eb469817524c42a80683e95793ed4800a6794366503355af046a726?d=identicon)[Juanchosl](/maintainers/Juanchosl)

---

Top Contributors

[![JuanchoSL](https://avatars.githubusercontent.com/u/18701207?v=4)](https://github.com/JuanchoSL "JuanchoSL (57 commits)")

---

Tags

logvalidatorvalidationstringdebugvalidatenumbersiterables

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/juanchosl-validators/health.svg)

```
[![Health](https://phpackages.com/badges/juanchosl-validators/health.svg)](https://phpackages.com/packages/juanchosl-validators)
```

###  Alternatives

[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[snapshotpl/zf-snap-php-debug-bar

PHP Debug Bar module for Zend Framework 2

3026.1k](/packages/snapshotpl-zf-snap-php-debug-bar)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
