PHP GTK on how to use - php

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.

Related

PHP: possible to compile a web-application into a windows application?

I have developed a PHP web application, but a client insists on a real Windows application, since he doesn't like running the software inside a browser.
Are there any solutions for this, any compilers to turn a web project into a Windows exe ?
I have looked at Phc-Win , but that seems more suited for small command line utils, not for entire web-applications...
UPDATE:
just found this myself, both look quite promising...
http://www.zzee.com/phpexe/
http://www.exeoutput.com/index.php
There's no tool for this, short of a simple wrapper app that embeds a browser inside an otherwise normal application window. Your PHP app would have to be completely re-written to include ALL of the overhead code necessary to build a GUI - basically all the 'display' stuff that a browser does automatically, would have to added to your app.
Well some of you did not google good enough:
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
Supports most of the "web-languages" to write native Applications.
Tutorial Reference for Appcelerator: http://appceleratortitanium.com/tutorials/3-appcelerator-titanium-tutorial-beginners.html
Quote:
"Q: What languages can I use to make desktop apps?
A: Javascript, PHP, Python, Ruby, HTML, HTML5, and CSS."
Not exactly what you are looking for: http://www.roadsend.co/home/index.php?pageID=compiler
You may look into "HipHop" (made by Facebook): Converts PHP to compileable C++-
There's a tool for this. :-) I never used it but you can try this: Winbinder.
It is simple to compile your PHP source code into an executable. Facebook released a compiler for PHP in early-2010, called HipHop, which aims to create C++. You could then compile this code, for example using gcc, to machine-code.
The more difficult point for a complex Web-App like yours is the user interface. When compiling the way I described above, the application can be run from command line - this might work for simple tasks, but not, if your application returns HTML.
One possibility to solve this problem is PHP-GTK. PHP-GTK is a API for GTK (the graphical user interface used by Linux Ubuntu by default), written in PHP. Using this solution would have to read some documentation about this API, and you would need to rewrite some parts of your program, but it would probably be the most beautiful solution, because it would create a "native" experience.
Another possible solution could involve Adobe AIR, which lets your create programs for the desktop, using HTML, CSS and JavaScript, but I don't know if and how this would work together with your compiled PHP.
Please also note that it isn't absolutely necessary to compile your PHP for it to run on the client's computer; You could also ship the PHP-interperter right with your (uncompiled) PHP-script. Of course, compiling brings benefits, such as faster execution of the program.
-- André

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

Is there any way to write php code and make it usable with same web-app which is in j2ee

I am using Eclipse to develop a website in html, css, js, ajax for client and jsp, servlets in the server side, using mysql. I want to write some modules in php. Is it possible to integrate php code in the architecture and run on tomcat ?
You could use Quercus or maybe create a bridge (effectively messaging) between a server running your PHP code and the Java application. I'd consider carefully if this is the best way to architect your application, or whether the php modules should be rewritten for Java.
Yes, look at PHP/Java Bridge http://php-java-bridge.sourceforge.net/pjb/
There is also a PHP runtime written in Java, but I don't remember the name at the moment.

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

PHP for iPhone Native

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.

Categories