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

Phalcon controller & JS

Is it good format to use one controller for one js ? or many controller for one js? Explain me please!!!!!!!!!:):)



17.5k

I assume you're talking about AJAX requests? I'm not sure what is best practice, but I use one controller for all non-authenticated AJAX requests and one controller for all authenticated AJAX requests. I try to push off most of the work to the models so the controller isn't doing much work...

My controllers say "OK, you're authenticated, here's the response the UI expects, now get the data the UI expects from the model."