PHP-GTK

PHP-GTK is a set of language bindings for PHP which allow GTK+ GUI applications to be written in PHP. PHP-GTK provides an object-oriented interface to GTK+ classes and functions. While PHP-GTK partially supports GTK2, GTK3 is not supported at all.[1]

PHP-GTK
Developer(s)Andrei Zmievski
Stable release
2.0.1 / May 16, 2008 (2008-05-16)
Operating systemCross-platform
TypeLanguage binding
LicenseGNU Lesser General Public License
Websitegtk.php.net

History

PHP-GTK was originally conceived by Andrei Zmievski, who is also actively involved in the development of PHP and the Zend Engine. The idea was received well by the PHP community, and more people started to get involved with the project. James Moore and Steph Fox were among the first to join in, contributing a great deal to PHP-GTK through their documentation efforts, and Frank Kromann - also from the PHP development team - supplied Windows binaries for the project.

The first version of PHP-GTK was released in March 2001. More people began to get involved, and several extensions were contributed introducing new widgets, such as Scintilla and GtkHTML. PHP-GTK 1.0 was released in October 2003 alongside several extensions including a wrapper for libglade, which allowed the cross-platform Glade UI builder to be used in creating PHP-GTK applications.

Present

Zmievski and Fox are still working on the project, with Fox now maintaining PHP-GTK for Windows.

The planned next major release, PHP-GTK 2 fully utilizes PHP 5's powerful object model support, and brings the improved portability of GTK 2.6 as well as its new set of widgets. The project also has support for GtkSourceView, which provides a source code editor widget. Around half the classes have been fully documented. Scott Mattocks, an active member of the PHP-GTK documentation group, has also written a book on the subject of PHP-GTK programming.[2]

The project is only compatible with GTK 2, not version 3.

WxPHP (WxWidgets for PHP) exists as an alternative to develop GTK PHP applications.

Example

Hello World PHP-GTK
<?php

function pressed()
{
    echo "Hello again - The button was pressed!\n";
}

$window = new GtkWindow();
$button = new GtkButton('Click');
$button1 = new GtkButton('Click');

$window->set_title('Hello World!');
$window->connect_simple('destroy', array('Gtk', 'main_quit'));
$button->connect_simple('clicked', 'pressed');
$button1->connect_simple('clicked', 'pressed');
$window->add($button);
$window->show_all();

Gtk::main();

?>

The sample PHP-GTK 2 program instantiates a GtkWindow widget with the title "Hello World!", containing a GtkButton labelled "Click Me." When the button is pressed, the message "Hello again - The button was pressed!" is displayed on the console via the callback pressed.

Deployment

Several tools have sprung up that assist the simple deployment of PHP-GTK applications. PHP compilers such as PriadoBlender and Roadsend PHP (Currently only compatible with PHP-GTK 1, while latest snapshot includes PHP-GTK 2) enable the compilation of applications written in PHP-GTK to a standalone binary executable. Alan Knowles' PECL package, bcompiler, also allows compilation of PHP into bytecode to hide the source code.

gollark: It's squirrel.
gollark: Coltrans, God would obviously use ed, the standard editor.
gollark: Use nano!
gollark: Maybe the April fools' joke is just that I only implemented an achievement, to make people paranoid.
gollark: This. The server hasn't done an April fools' joke yet, so it should.

See also

  • wxPHP, PHP bindings to wxWidgets
  • PHP-Qt, PHP bindings to the Qt toolkit
  • WinBinder, Microsoft Windows API bindings for PHP.
  • PHP Desktop, PHP desktop GUI framework with HTML5 Chrome/IE engine
  • php-gui, an "extensionless" PHP GUI library

References

  1. "Language Bindings". Archived from the original on 2011-07-13. Retrieved 2015-01-28.
  2. Mattocks, Scott. Pro PHP-GTK. ISBN 1-59059-613-7.
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.