Reputation: 42450
I have a website that I built on the CodeIgniter framework. It implements the MVC architecture.
My dilemma is: I am developing applications for mobiles. A little research told me that mobile apps cannot connect directly to MySQL databases and thus, I need to have a service layer in between - in my case, they will be PHP scripts.
Is it possible (and should I) for me to integrate these scripts into my MVC architecture. If yes, how should I go about it?
Currently, I have this in mind:
Would that be the correct way to implement it?
This is my first time implementing something like this so I want to make sure I'm not missing something.
Upvotes: 4
Views: 1563
Reputation: 13640
Better yet, create a full REST server for your mobile app to use. You can get an idea of how easy it is with this tutorial:
http://net.tutsplus.com/tutorials/php/working-with-restful-services-in-codeigniter-2/
This will have a link to the library as well,
Upvotes: 2
Reputation: 2763
You are right and I suggest that you encrypt the data before encoding it as JSON and decode it on the mobile if the data is secure and also test weather the the request from a mobile device or not you can achieve this by sending parameters with the request and check it on the server to avoid direct access Good Luck
Upvotes: 0