2

So, essentially, the question is, to develop a PHP back-end to an iOS application, would you implement an MVC architecture on the PHP side? Or no, since the client side (iOS) already has an MVC architecture?

Or, since we're just passing happy little JSON packets in between front / back end, both server and client should employ MVC architecture? Thus we can implement "private api key" authentication and other security measures at the device level?

Any ideas suggestions welcomed.

  • 1
    If you only need JSON and nothing else I guess you can mostly skip the view part. You would still have models and controllers. The models obviously for database interaction and business logic (if needed) and the controller to handle the requests. This assuming that (like with Rails) there is an easy way in PHP to generate JSON directly from the data structures, if not you may want a simple view layer to generate JSON. – thorsten müller Dec 7 '14 at 15:56
  • yeah, json_encode and decode are not bad. I guess I can keep the MC part and ditch the Views, after all, they are generated in the iOS part of the app – fizzy drink Dec 7 '14 at 16:08
3

I use MVC in both. Yes the views server-side are very simple, but that's ok. Still nice to have separation of concerns for all the usual reasons.

  • Would the server side Views be considered the public API of the app? – fizzy drink Dec 8 '14 at 19:29
  • Well for me the public api is the URL and the expected response... My mental model is that the views on the server side are a super simple view that returns JSON. Hope that helps. – Todd Chaffee Dec 8 '14 at 21:05
0

Using a PHP MVC framework for ios development is a good idea but you should definitely take a look at these Moblile App development frameworks.They additionally provide access to back-end API's & you can run tests in php,python,ruby etc.(Mostly they work both for ios & android apps). And if its only that you want to use a php framework then take a look at dolphinphp framework.It is the first php framework for native cross-platform mobile app development.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.