We were lucky to present this talk at the Berlin Online PHP Conference online in 2022.
In most web applications today, we need to validate the data submitted. It can be through an API endpoint, a CSV line to import, a form, or anything that will be injected in the app. Since the latest PHP versions, we have more and more tools to improve type hinting in our code. There are multiple input validation methods. In France, we use the symfony/validator package a lot. However, those packages don’t validate the data at the right time. We need to build objects that may contain invalid data and then we apply some rules and retrieve the errors. This means that those objects must allow an invalid internal state. It’s not a really good approach to write solid code. Is there another solution? Of course, you can validate the data before building the object. Let’s dive into Valinor: a tiny library that will let you remove a lot of boilerplate code but still keep your application solid!
Talk abstract
You can find the slides here: public.chstudio.fr