filterus
filterus copied to clipboard
A simple filtering library for PHP
I have a validation requirement where an array can look like either of these: ``` [ 'name' => 'string', 'from_address' => 'email', 'from_name' => 'string', 'subject' => 'string', 'body_plain' =>...
There isn't an implementation for `validate` for emails, so although an empty string will be correctly filtered to `null`, it will validate as `true`, which is not desirable. Repro code:...
Having an array like ``` array(19) { 'sku' => string(2) "SW" '_type' => string(6) "simple" '_attribute_set' => string(18) "xxxxx" '_product_websites' => string(10) "xxxxx" 'name' => NULL 'description' => string(8) "TESTTEST"...
Hi, thanks for providing this library. I have the following solution to allow "string or null", and will provide it below. However, if there is a better way to do...
Fixed the headers. I also edited the first method definition for more consistency with the second method example.
In PHP7 some classnames are reserved and requires a change. This is discussed in https://github.com/Respect/Validation/issues/362 Their suggestion is to use the prefix Type on the classes.
``` php $arr = [ 'a' => 1, 'b' => 2, 'c' => 3, 4 => 4, ]; \Filterus\Filter::factory('array, keys:string')->filter($arr); ``` Doesn't remove `4`. I noticed you've got [`is_scalar()` testing,...