views:

243

answers:

2

I do a lot of coding in PHP and MySQL, but I'm looking at moving my applications to a desktop environment in order to allow users to access the data offline, and periodically receive updates from a central online database.

For the time being, however, I'm looking for a decent tutorial on how to convert PHP applications to Cocoa, and how to store the data I currently have in MySQL in a fashion that will be usable by the application. Does anyone know of a good starting place?

+3  A: 

I dont know if "converting" your app is really the way to do. I'd advise you to learn Cocoa, learn the way things are done with it, read the user interface guidelines ,decide what functionality is important for offline use, then implement them. Different languages/platforms have different strengths, so trying to duplicate/convert everything your php application does is not generally a good idea.

There are other alternatives that will let you deploy rich internet applications to desktop environments if all you really want is to be able to run your web app locally, Adobe Air is one of these although I don't know about how well it supports php.

sjobe
+1 You shouldn't be thinking of this as "converting a PHP application" — you should be thinking about how to make a good Cocoa app that does the same task as your PHP app. Trying to "convert" a Web app will be more difficult and result in a worse product.
Chuck
You both make an excellent point; after all, there's much more that can be achieved in Cocoa than in PHP on its own, anyway, so why not use it as an opportunity to design a better app!
Kaji
+3  A: 

I think you're asking the wrong question. Per sjobe, a straight "conversion" would likely be a bad idea and unnecessary to accomplish your aim of local access to data normally provided by a server reached over the Internet.

You provide two requirements:

  • users must be able to access their data offline
  • users must be able to sync that data with the online data store

You should think harder about how to accomplish these aims, then return to answering this question only if necessary.

You can doubtless find enough "Cocoa" applications out there that are only nominally Cocoa applications by the dubitable virtue of linking against the Cocoa framework. Cocoa is a means to an end: providing a seamless experience with your application to a Mac OS X user. If you can come up with better way to do that given your requirements and any other constraints, by all means, do it that way, Cocoa be damned.

Adobe Air is directed towards use of Flex and ActionScript. Google Web Toolkit uses Java to accomplish similar aims. There might be a good, ready-to-go option for running PHP web apps on the desktop; I don't know.

Another option might be simply having the users run your PHP web app on a local web server (Mac OS X comes with Apache and PHP). This is the route that Aigaion, which lets you manage a bibliography database, takes. The twist would be syncing with the server's data store.

In brief: don't look to "convert a PHP application to a Cocoa application"; look to satisfy your needs within the constraints of the Mac OS X platform (or the Windows platform, or the Haiku platform, or…).

Jeremy W. Sherman
Additionally, Google Gears can provide offline functionality.
Michael E
Whether there's a "ready-to-go" solution fot running PHP apps on the "desktop," I guarantee there isn't one for running them on the Mac.
Chuck
Looking around Interface Builder, I've noticed a webkit component that seems to allow embedding web content; would that serve a similar function on the Mac?
Kaji
If you went the local webserver + web browser route, you could indeed build the user's access to the application around a webview filling a window. This would let you break out of the browser whenever appropriate.A webview is like having the page display portion of Safari at hand. You have to provide the controls to set the URL (location bar), go forward/back (buttons), etc., but hyperlink support and page rendering come for free.
Jeremy W. Sherman