Question

Not really a coding question exactly, and not sure which stack site to throw this on, so here goes.

Im wondering if there is any framework similar to appmobi/phonegap in the sense everything is sandboxed and compiled into an app format for both iphone and droids. Where the sandboxed server comes with the ability to run PHP on it, I've been tryin to search all day and I've come up with nothing as of yet other then heaps of articles on appmobi/phonegap. This could be a free or paid for framework (preferably free/open source).

If theres no frameworks like that then is there a means of taking something like apache itself that acts and runs like a webserver where I can load php into it, and at the end of my project compile it into one final package for use in the mobile markets?

Was it helpful?

Solution

The problem is that iOS generally uses Objective-C and the Android uses Java, but both can use javascript, which is why phonegap works.

So, unless you can write two webservers, one for iOS and one for Android, and port PHP to run under your webserver, or, more likely, write an interpreter that will take PHP and transform it to run on your webserver, then it would work.

But, if you write a mobile web application and use PHP as the code on the server, then you can send javascript and have that run in a browser on both devices.

The best option would be to have most of your business logic be in REST services that are written in PHP. You can do this in PhoneGap by following this blog:

http://share.ez.no/blogs/thiago-campos-viana/rest-api-basic-http-auth-and-phonegap-using-jquery

Here is the main part of the article though, so you can see how easy it can be.

 //10.0.2.2:80 is the localhost in android emulator, app needs internet access
    $.get("http://10.0.2.2:80/ez_site/api/ezp/content/node/2",
               function(data) {
                 //code goes here

   });

By doing this then you can have most of your business logic in PHP, and have just the UI be in javascript, able to take advantage of the hardware on the phones.

OTHER TIPS

No. Attempting to include a web server and PHP runtime inside of a mobile application would have serious performance implications.

The reason PhoneGap works is because Javascript can execute natively in mobile applications by using the built-in web browser's rendering engine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top