Download the PHP package toshy/validation-bundle without Composer
On this page you can find all versions of the php package toshy/validation-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download toshy/validation-bundle
More information about toshy/validation-bundle
Files in toshy/validation-bundle
Package validation-bundle
Short Description Additional Symfony validators.
License MIT
Homepage https://secit.pl
Informations about the package validation-bundle
Symfony Validation Bundle
Additional validators set for Symfony 6/7.
This is a fork from secit-pl/validation-bundle.
Installation
From the command line run
Validators
NotBlankIf
This validator checks if value is not blank like a standard NotBlank Symfony validator, but also allows define the condition when the NotBlank validation should be performed using Symfony Expression Language.
From Symfony 6.2 you can also use When validator.
https://symfony.com/blog/new-in-symfony-6-2-conditional-constraints
Example usage
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
expression | string | empty array | The expression that will be evaluated. If the expression evaluates to a false value (using ==, not ===), not blank validation won't be performed) |
values | array | empty array | The values of the custom variables used in the expression. Values can be of any type (numeric, boolean, strings, null, etc.) |
FileExtension
This validator checks if file has valid file extension.
From Symfony 6.2 you can also use the "extensions" option in File validator.
https://symfony.com/blog/new-in-symfony-6-2-improved-file-validator
https://symfony.com/doc/6.2/reference/constraints/File.html#extensions
Example usage
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
validExtensions | array | empty array | Allowed/valid file extensions list |
disallowedExtensions | array | empty array | Disallowed/invalid file extensions list |
matchCase | bool | false | Enable/disable verifying the file extension case |
Caution! It's highly recommended to use this validator together with native Symfony File/Image validator.
CollectionOfUniqueElements
Checks if collection contains only unique elements.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
matchCase | bool | false | Enable/disable verifying the characters case |
customNormalizationFunction | null or callable | null | Custom normalization function |
This validator can also be used to validate unique files upload.
AntiXss
Checks if text contains XSS attack using voku\anti-xss library.
NaiveNoHtml
Perform very naive check if text contains HTML.
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
strongValidation | bool | true (recommended) | Enable/disable strong validation. Disable if you'd like to allow strings with unclosed tags such as as "I <3 You". |
BurnerEmail
Checks if email address is a throw away email addresses (burner email).
This check is perform against the list provided by wesbos/burner-email-providers.
You need to install this package manually (composer require wesbos/burner-email-providers
) if you'd like to use this validator.
All versions of validation-bundle with dependencies
symfony/framework-bundle Version ^6.0|^7.0
symfony/dependency-injection Version ^6.0|^7.0
symfony/expression-language Version ^6.0|^7.0
symfony/http-foundation Version ^6.0|^7.0
symfony/validator Version ^6.0|^7.0
voku/anti-xss Version ^4.1