From a look at the Symfony documentation, there is no built-in validator for decimals. You can use a callback validator, or, even better, you can create your own validator similar to this article here. .
As for the actual validation, I would use a combination of is_numeric and is_float to validate. There are methods using regular expressions, but, in my opinion, if the value satisfies either the is_numeric or is_float , then you can safely assume that this is a valid decimal (or integer).
EDIT:
Perhaps the best solution would be to check the decimal number as a string. Sort of...
$stringDecimal = strval($decimalValue); return (preg_match(/[0-9]+(\.[0-9][0-9]?)?/, $stringDecimal) !== 0);
While this is not perfect (you can easily pass "1.15adowadjaow" and it will check), it serves as the basis for what you need. Combining the above regex with something that searches for anything other than 0-9, fullstop, or a comma (depending on whether you want to use European decimal formatting).
source share