Avoid exposing model to client/api

I'm developing a REST API with Phalcon and I'm wondering what the best approach would be to avoid exposing raw model data to my endpoints. Should I be using DTO's and/or annotations (if possible with Phalcon) where a DTO might be overkill? Any help/examples would be appreciated.



7.9k

There is a nice example in the repo. https://github.com/phalcon/phalcon-api This should give you some great pointers.