PHPackages                             digicomp/settingvalidator - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. digicomp/settingvalidator

ActiveNeos-package[Validation &amp; Sanitization](/categories/validation)

digicomp/settingvalidator
=========================

Just a Neos\\Flow Validator resolving other Validators with Configuration/Validation.yaml

3.1.1(3y ago)15.4k[1 issues](https://github.com/digital-competence/DigiComp.SettingValidator/issues)MITPHPPHP &gt;=7.4CI failing

Since Apr 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/digital-competence/DigiComp.SettingValidator)[ Packagist](https://packagist.org/packages/digicomp/settingvalidator)[ Docs](https://github.com/digital-competence/DigiComp.SettingValidator)[ RSS](/packages/digicomp-settingvalidator/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (2)Versions (21)Used By (0)

DigiComp.SettingValidator
=========================

[](#digicompsettingvalidator)

This package allows configuring validators with a new configuration type.

Introduction
------------

[](#introduction)

This package provides the `SettingsValidator` which uses the configuration type `Validation` to resolve the validators that should be applied to the value. It distinguishes between validators that are applied to the value itself and its properties.

Resolving the validation configuration
--------------------------------------

[](#resolving-the-validation-configuration)

The `SettingsValidator` has an option `name`. If it is set, the name is used to resolve the validation configuration, otherwise the type of the value is used, which is mainly useful for objects where the FQCN is used.

### Resolving by option `name`

[](#resolving-by-option-name)

To resolve the validation configuration by name just use the option `name`.

```
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @var MyObject
 */
protected MyObject $myObject;
```

The `SettingsValidator` will search for an entry inside the `Validation.yaml` with that name.

```
MyNamedValidator:
  ...
```

### Resolving by type

[](#resolving-by-type)

To resolve the validation configuration by type just do not set the option `name`.

```
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings")
 * @var MyObject
 */
protected MyObject $myObject;
```

The `SettingsValidator` will search for an entry inside the `Validation.yaml` with the FQCN of `MyObject`.

```
My\Package\Domain\Model\MyObject:
  ...
```

The validation configuration
----------------------------

[](#the-validation-configuration)

### Difference between `self` and `properties`

[](#difference-between-self-and-properties)

`self` contains a map of validators that are applied to the value itself. `properties` contains a map with property names of the value you would like to validate and each entry contains a map of validators that are applied to that property.

```
MyNamedValidator:
  self:
    ...
  properties:
    myProperty1:
      ...
    myProperty2:
      ...
```

### Configuring a validator

[](#configuring-a-validator)

To configure a validator you use the type of the validator as key and the options as entries of that key. If the validator has no options or all the default values are used, set an empty map as options.

```
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
        myOption: "myOptionValue"
  properties:
    myProperty1:
      'My.Package:SomeOtherValidator': {}
    myProperty2:
      'My.Package:SomeOtherValidator': {}
```

### Disable a validator

[](#disable-a-validator)

To disable a validator you need to set the options to `null`.

```
MyNamedValidator:
  self:
    'My.Package:SomeValidator': ~
```

Using the `SettingsValidator`
-----------------------------

[](#using-the-settingsvalidator)

The `SettingsValidator` can be used to reduce the number of `@Flow\Validate` annotations and gives you the possibility of overwriting existing validation configurations in other packages.

### Using on properties

[](#using-on-properties)

Old PHP code:

```
/**
 * @Flow\Validate(type="My.Package:SomeValidator", options={"myOption"="myOptionValue"})
 * @Flow\Validate(type="My.Package:SomeOtherValidator")
 * @var MyObject
 */
protected MyObject $myObject;
```

New PHP code:

```
/**
 * @Flow\Validate(type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @var MyObject
 */
protected MyObject $myObject;
```

New validation configuration:

```
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
      myOption: "myOptionValue"
    'My.Package:SomeOtherValidator': {}
```

### Using on actions

[](#using-on-actions)

Old PHP code:

```
/**
 * @Flow\Validate(argumentName="myObject", type="My.Package:SomeValidator", options={"myOption"="myOptionValue"})
 * @Flow\Validate(argumentName="myObject", type="My.Package:SomeOtherValidator")
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

New PHP code:

```
/**
 * @Flow\Validate(argumentName="myObject", type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

New validation configuration:

```
MyNamedValidator:
  self:
    'My.Package:SomeValidator':
        myOption: "myOptionValue"
    'My.Package:SomeOtherValidator': {}
```

### Using inside validator configurations

[](#using-inside-validator-configurations)

You can use the `SettingsValidator` inside the validator configuration to easily construct flexible structures.

```
MyNamedValidator:
  properties:
    myProperty1:
      'DigiComp.SettingValidator:Settings':
        name: "MyOtherNamedValidator"

MyOtherNamedValidator:
  self:
    'My.Package:SomeOtherValidator': {}
```

Providing an empty validator
----------------------------

[](#providing-an-empty-validator)

It can be useful to provide an empty validator in code that is used by many projects. By doing so you can make sure that a different validation is possible in any project.

```
/**
 * @Flow\Validate(argumentName="myObject", type="DigiComp.SettingValidator:Settings", options={"name"="MyNamedValidator"})
 * @param MyObject $myObject
 */
public function myAction(MyObject $myObject)
{
    ...
}
```

```
MyNamedValidator: {}
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 64.4% 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 ~179 days

Recently: every ~192 days

Total

19

Last Release

1265d ago

Major Versions

1.0.3 → 2.0.02017-09-04

2.1.2 → 3.0.02020-08-31

PHP version history (3 changes)1.0.2PHP &gt;=5.3.0

3.0.0PHP ~7.4.0

3.1.0PHP &gt;=7.4

### Community

Maintainers

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

---

Top Contributors

[![fcool](https://avatars.githubusercontent.com/u/304736?v=4)](https://github.com/fcool "fcool (38 commits)")[![DanielSiepmann](https://avatars.githubusercontent.com/u/354250?v=4)](https://github.com/DanielSiepmann "DanielSiepmann (21 commits)")

---

Tags

flowframeworkphpvalidationyamlvalidationflowNeos

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/digicomp-settingvalidator/health.svg)

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

###  Alternatives

[composer/semver

Version comparison library that offers utilities, version constraint parsing and validation.

3.3k534.3M1.1k](/packages/composer-semver)[giggsey/libphonenumber-for-php

A library for parsing, formatting, storing and validating international phone numbers, a PHP Port of Google's libphonenumber.

5.0k163.3M564](/packages/giggsey-libphonenumber-for-php)[respect/validation

The most awesome validation engine ever created for PHP

6.0k40.8M426](/packages/respect-validation)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k41.2M157](/packages/propaganistas-laravel-phone)[opis/json-schema

Json Schema Validator for PHP

65446.2M350](/packages/opis-json-schema)[giggsey/libphonenumber-for-php-lite

A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber

9518.1M84](/packages/giggsey-libphonenumber-for-php-lite)

PHPackages © 2026

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