4

I know that PHP is an interpreted language and for web-based things, isn't designed for running GUI applications on actual OSs, but is there a way?

Basically, is there a framework / system that allows me to create "native" (basically, binary, .exe, looks like a Win32 app with the native controls and all) windows, GUI-based applications?

So I could code a PHP app with such framework, and (somehow) compile it into an .exe, and distribute it as a normal windows application. Possible?

I could use VS/.NET , C# and all, but using PHP would allow me to reuse an internal framework for many extra functions, shortening the development cycle a lot.

So, is there such a way to do it?

Jimmie Lin
  • 2,205
  • 2
  • 23
  • 35
  • Just gave a modern answer to this over here: https://stackoverflow.com/questions/4576631/any-real-mvc-library-in-php-for-gui-apps/62133654#62133654 – still_dreaming_1 Jun 01 '20 at 14:03

5 Answers5

3

You can use any number of GUI toolkits that have PHP bindings, such as GTK+ through PHP-GTK.

Then you can 'compile' it with something like HipHop, which transforms your PHP into optimised C++ that you can then proceed to compile. Of course, compilation is not necessary at all, but if you want to, it's possible.

Delan Azabani
  • 79,602
  • 28
  • 170
  • 210
3

The best solution if you have knowledge of .Net would be to use Phalanger (Blog) which basically compile php code to the .Net intermediate language and allow you to access all standard .Net libraries (including WPF and WinForms so you could create GUIs)

The more modern version of this project is now called PeachPie.

enter image description here

still_dreaming_1
  • 8,661
  • 6
  • 39
  • 56
Julien Roncaglia
  • 17,397
  • 4
  • 57
  • 75
  • I'll try 'compiling' my internal framework to see if it works for a .NET system. Though, it still doesn't save as much development time as directly using PHP for the entire app... – Jimmie Lin Jul 29 '11 at 08:17
  • Why can't you use php for the whole App ? Just use the .Net framework libs that you like and go with it. If the wiforms designer does not work (I don't know if phalanger provide support for it) you could still use the library directly (`$form = new Form()`). – Julien Roncaglia Jul 29 '11 at 08:20
  • Oh, I thought you could only compile the PHP code into a C# file, then you could only rely on .NET for the rest of the app. Umm, it's very interesting, I'll certainly try it out! Will accept your answer later if no more suggestions come. Thanks! – Jimmie Lin Jul 29 '11 at 08:22
  • Technically it really compile PHP code into .Net, directly without passing by another language like C#. You could generate dlls that other .Net developers could use, or make an executable take advantage of obth .Net dlls and (compatible) php libraries. – Julien Roncaglia Jul 29 '11 at 09:44
  • With Phalanger you are limiting yourself to just windows. Another good alternative is PHP Nightrain. It supports Mac, Windows and Linux. http://www.naetech.com/php-nightrain – roosevelt Aug 01 '14 at 22:56
2

Yes, there is a IDE called DevelStudio. It has a Visual-Studio like interface and you can write all your code in PHP and by pressing a button it compiles into .exe that runs standalone.

  • Seems very interesting, thanks! Does the application work for English systems, too? Learning Russian is a hard job for me, haha.. – Jimmie Lin Jul 29 '11 at 08:15
  • 1
    Oh, well, learning a language would slow down development time significantly, haha... I knew I should have learned Russian a few years ago. :P – Jimmie Lin Jul 29 '11 at 08:18
1

There is PHP-GTK Take a look at that

Julien Roncaglia
  • 17,397
  • 4
  • 57
  • 75
musse1
  • 379
  • 4
  • 17
  • I've tried PHP-GTK before, it seemed to be a little outdated and I couldn't get it to work properly on some platforms though... – Jimmie Lin Jul 29 '11 at 08:14
0

There is DevelNext, but there are JPHP. JPHP - is PHP. It compile to Java byte code. simple code comatible, but no chance that any existing real PHP class will work. No chance. But IDE DevelNext is cool.

Igor Teterin
  • 123
  • 6