On Tue, Mar 27, 2018 at 8:03 PM, Crocodile <crocodil...@gmail.com> wrote:
> It's almost always the case that you need to provide a meaningful feedback > about what exactly went wrong, rather then to just say "Failed!" While > simplicity is nice and you cannot overrate value of validation, this whole > thing is pretty much useless to me personally without this ability. Also, I > don't think it's a good idea to mix validation of scalar values, arrays and > even multiple arrays, in a single function. > There are 3 types of validations in general. There are only 3 types of inputs. Explaining them need lots of word as well as for other fundamentals/principles related to this. https://blog.ohgaki.net/computer-programming-fundamentals-and-basics-input-validation You are referring to "Business Logic Validation" which needs feedback to users in case they send incorrect values. "App Level Input Validation" does not require feedback other than "You sent really bad request. This has been reported to admins." Therefore, App Level Input Validation can validate ALL inputs at once and there is no good reason not to do this. Btw, you can use the validator for a single value validation as well. It also able to disable Exception so that one can use it for "Business Logic Validations" as well. https://github.com/yohgaki/validate-php-scr/tree/master/src/examples Regards, -- Yasuo Ohgaki yohg...@ohgaki.net