obf / validator
The Opsbears Framework Validator Components
Installs: 3 604
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 5
Forks: 0
Open Issues: 0
Requires
- php: >=5.4
- obf/classloader: 1.*
- obf/foundation: ^0.9.0
- obf/regexp: ^1.2.1
Requires (Dev)
- opsbears/coverage-reporter: ^0.0.3
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2019-02-20 18:23:20 UTC
README
Validators
Validators are classes that validate a value, but don't change it. They can either return true or false, indicating if a value is valid or not.
All validators should implement the iValidator
interface:
interface iValidator { /** * @return bool */ public function validate($value); }
Some validators also come with static functions to make type checking easy.
This library comes with a basic set of validators:
Class | Description |
---|---|
BooleanTypeValidator | Does a strict or loose validation if a certain value is a boolean value. |
BooleanValidator | Only provides type checking for boolean |
Filters
Filters not only validate data, but also process it. This helps with transforming the data in a way that is suitable
for further processing. Filters should implement the iFilter
interface:
interface iFilter { public function filter($value); }
The filter module only provides a few basic filters, the rest are implemented in different namespaces:
Class | Description |
---|---|
BooleanFilter | Converts a value into a boolean. It respects the iBooleanConvertible interface from Foundation. Attempts to guess the value if a string is provided, based on the verbs submitted. |
FloatFilter | Converts a value to a float. It respects the iFloatConvertible interface from Foundation. |
IntegerFilter | Converts a value to an int. It respects the iIntegerConvertible interface from Foundation. |
StringFilter | Converts a value to a string. It respects the iStringConvertible interface from Foundation. |