PHP for iPhone Native - php

Can I compile PHP to a native iPhone app?

No. You can, though, make web apps that look an awful lot like they're iPhone apps.

Take a look at Titanium Mobile.
I've used their desktop developer, which can use PHP but not the mobile version

Perhaps a bit of elaboration. You cannot "compile" PHP. It is a scripting language. Yes you can compress, obfuscate, and even turn it into an Apache Module etc. but it is an interpreted language so at some point will need the/a php interpreter and a web server. So to get it to run on any hardware platform mean having the php engine and/or an Apache server to be there.
So to make any self contained app you need to have a programming language that will compile and produce an executable file that is supported on the target hardware or is self supporting. But essentially produces a bundle containing all the resources required to run that app whether it is an iPhone, Palm Pre, Mac or PC. For the iPhone Objective-c is used to program, connect to the libraries and frameworks and produce the required bundle to install on the iPhone. You can use Mono via Monotouch to do the development work but it then compiles to the required bundle for installation.
If you want to use PHP then build a web based app that will be accessible via Mobile Safari on the iPhone. To make the app render well you will need quite a bit of HTML, JavaScript and CSS but as has been mentioned there are frameworks to ease this pain such as iUi, iWebkit, jQTouch etc.

Related

Convert php code to native android application?

I am familiar with phonegap framework which convert html & jquery code to native app. But it does not support php. So i am looking for alternative.
with Zend Studio 10 you can make your app using PHP
Cloud Connected Mobile app is new entry for PHP Developers to make native apps(android, blackberry, windows phone) with just SINGLE click.
Zend CCM link
PHP is a server side language while jQuery and html being client side. What I mean is this that the PHP script is being interpreted on the server using the PHP plugin and compiler and so if it has to run on phone it need to be compiled in the phone with the required plugins.
Seems impossible to now because of that the PHP compiler is not available for android and for making such you should be able to port it to android.
Which I think takes a lot of time and digging the PHP compiler sources.
In my personal view, do not use a language designed specifically for web server-side purposes on a web client. Everything you can do with PHP locally on a phone you can also do with Javascript, and usually much easier because of its tight integration with the browser.
That said, there is a PHP for Android project which might provide what you want.

Rendering web content in offline/desktop applications

For a while now, I've been thinking about the question of user interface, with regard to ease of implementation and cross-platform compatibility. I'm primarily interested in developing desktop applications, for things that don't have a server-side storage model, or situations where internet connectivity is intermittent, etc. However, I've started doing some work on my employer's website, and found in that time that web site interfaces are very easy to develop, especially in comparison with the cross-platform UI tools I've used in the past.
With that in mind, I want to know: what are the tools/libraries available that can be integrated into a desktop application to render web content? Could be HTML, PHP, JavaScript, with/without CSS, etc. How easy/difficult are they to use?
You might actually want to check out Microsoft's Windows Presentation Foundation. It takes a lot from how the web works and applies it to desktop application development. It's not exactly HTML/CSS/PHP/JS, but it's not far off, either. It does have a bit of a learning curve, but the markup is XML based, so it's largely just a matter of learning its quirks, and of course, the .Net languages and framework (though, theoretically, you could use PHP on the .Net framework).
You might also be interested in Appcelerator Titanium, which allows you to use HTML/CSS/JS to build desktop applications. I don't know what it's desktop development is like, but I've used it for iPhone development, and it has promise.
If you want to play around with plugin/extension writing, the latest Gnome desktop environment (Gnome 3 - http://www.gnome.org/) actually runs completely off of HTML/CSS/JS and could use people to help build their extension library. It is, literally, writing desktop apps! :) (You would, of course, have to run Linux to play with it, but Fedora 15 uses Gnome 3 by default, and Linux in general comes with a number of powerful text editors, and the community has done a great job writing tutorials and documentations for getting started.)
If I understand the question right, to my knowledge there is nothing truly cross platform for doing this, you would always have to write a different version for each target platform.
Most windows apps that render web content sub the task out to IE, but I don't know how *nix app would handle this.
To use PHP to do anything on the local machine, it would have to be installed on the local machine. You can supposedly build full Windows GUIs in PHP with Winbinder although I have never messed around with it myself.
For windows-only apps, you might find HTA interesting - these are (sort of) self-contained HTML/Jscript apps and you can use links and Jscript to fetch content from remote servers.
I think your best bet would be Java though - the Java mantra is 'Write once, run anywhere' and Java GUIs are extremely portable. I'm sure I remember coming across something whereby you could use HTML to build bits of a Swing GUI as well...
What about Adobe Air? I'm not caught up on its capabilities, but I run Pandora Desktop on my Mac, which goes through Adobe Air - My impression was that it fulfills what the OP is asking.
You should have a look at Adobe AIR:
Adobe AIR with PHP/MySql or SQLite
http://www.vtc.com/products/Adobe-AIR-PHP-Development-Tutorials.htm
Never used it though so I can't really give you details but maybe somebody who has can... hope this helps

PHP GTK on how to use

I have no knowledge on desktop applications, but I have a project in our school desktop application and only I know is to make websites using php, javascript, css and etc. I heard about PHP GTK and I already read many articles and tutorial for windows. But still, I didn't understand on how can I start developing a PHPGTK desktop application. I need somebody that will explain to me on how I can install, compile php to .exe to execute it. Or any Idea on how can I make a desktop application that using PHP, MySQL, HTML, javascript or any web language except dontnet. I need a browser free for this. I see a application that uses web language and see what he did but I didn't understand. Here is the name of application "CabalRider". Thanks for your replies.
Try Titanium you can code programs for Windows, Mac, and Linux using html, css, javascript, and php.

php library iPhone

I'm wondering if anyone knows of a PHP library that I could compile into my app for the iPhone? Basically I'm wanting to allow the phone to display pages stored locally that have PHP in them and display them in a UIWebView.
Apple are extremely strict about not allowing 3rd-party code execution engines in apps, which would prohibit running a PHP interpreter.
If PHP is a true requirement, you'll have to host it on an external server and access the pages remotely.
Consider Javascript as an alternative language if you need to stay local, it's really the only way to execute run-time-generated code on the iPhone.
In order for that to work you would need:
A PHP compatible webserver running on your iPhone
Some sort of a PHP interpreter (not that there are so many different types of them out there) running on it too
I don't think this is/will be possible when thinking of Apple's strictness regarding 3rd party software and the low chances of someone even planning a port of PHP for the iPhone.
You mean like this PHP library? http://php.net/downloads.php
Running your debugged PHP code in an iOS app makes a lot of sense to me. Getting a PHP library in an iOS app and approved by Apple isn't easy, but it's been done. See: Running PHP on iOS? for details.

Running a PHP application in a desktop environment

I have been pondering about this for a few days, and I'm surprised this hasn't been done yet or isn't very popular.
What I would like to see was a way to run a PHP application inside a desktop application. For example, the application would need its own mini webserver that doesn't handle requests, but allows PHP to be run.
Sometimes I have been set with tasks that clients demand coded in C# or .NET, and I think to myself 'I could have this done so much quicker if I could use PHP'.
Does anyone have any information on this subject? And FYI I do know PHP is meant to be a web programming language and is not meant to be run in a desktop application, but I'm intrigued :)
PHP-GTK hasn't had a new version since 2008, but it may suit your needs.
http://gtk.php.net/ is exactly what you want. You will be using an old GTK version, at least until a new php-gtk version is released (which is expected soon, according to the main page), but even that shouldn't be a big problem.
Also, see http://news.php.net/php.gtk.dev, it shows there is still activity on the project.
If you mean console (command-line) applications then by all means you can do that. I do it all the time, both on Windows and Linux. Obviously you will not have web-server related variables ($_GET and so on) but other than that you have full functionality of PHP.
See this for details.
PHP installations come with two executables, one for CGI (common gateway interface) and one for CLI (command line interface). Just set up PHP on your machine and use the correct php.exe.
If you mean applications with windows then, like others say, there are frameworks for this, but I doubt this is a good idea.
Well if you write a simple shell in .NET, you can drag a web browser object into the desktop app and simply show a webpage inside there, without the browser controls (back, home, etc).
This is a bit hackish, if you want a desktop app, code a desktop app, you'd be surprised how easy it is in C#.NET. And obviously the PHP needs to run somewhere, either on an external website or a local web server (ex: XAMP)
I've done a couple of applications for a customer using miniPHP Studio for exactly the same reasons. Both me and the customer were happy about the result. Might take some time to get used to it, but it has a kind of a debugger built into the IDE and, being based on Winbinder, you can use its forum to pick up more code samples.
Stuff I definitely found out works well with it: PDO, MySQL, SQLite, cURL, mbsting, mhash, mcrypt, bz2, ADODb (after modifications), running external programs. Stuff I never managed to make behave: FreePDF, having the input fields accept Unicode characters.
For the future (read: as soon as I find some free time) I'm gonna take a look at Titanium. This one definitely looks as being actively developed and on a path upwards.
PHP Nightrain is a packager written in Python for the PHP Programming Language. Using this tool you can convert your PHP/HTML/CSS/Javascript application to a Native Desktop Application. Currently, PHP Nightrain supports the Windows, Mac (OS X) and the Linux operating systems.
Features:
PHP 5 Pre-compiled
Option to use your own PHP
GUI rendering your PHP/HTML Web Application
Set custom width and height
Start application Maximized if required
Start application Fullscreen if required
Window Title changes as the value of the title tag changes
executable for Windows
executable for Mac
.app file for Mac
executable for Linux
https://github.com/naetech/nightrain
http://www.naetech.com/php-nightrain

Categories