We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

What validation should I use?

I see that there is model validation and form validation - What type is the best to use?

In the form, i can use PHP to setup the form, but I really don't need that function, so is that the only difference?

  • Phalcon\Validation: To validate forms, external input, json, etc.
  • Phalcon\Mvc\Model\Validation: To validate model data integration rules.

So if i am going to past some data, like signup, new post and so on, i have to use the "forms" validation, and not the validation inside the models??

And thanks for the answer :-)

Yes, Phalcon\Validation would be better there

Okay thanks for commenting so fast :-)

Is it normal that it can take more than 2 secs before the validation is finish? And do you maybe have an example on how the best way to validation data with Phalcon? :-)