PHP-GTK is a set of
language binding
In programming and software design, binding is an application programming interface (API) that provides glue code specifically made to allow a programming language to use a foreign library or operating system service (one that is not native to th ...
s for
PHP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. ...
which allow
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
GUI
The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
applications to be written in
PHP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. ...
. PHP-GTK provides an
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of p ...
interface to GTK classes and functions. While PHP-GTK partially supports GTK2, GTK3 is not supported at all.
History
PHP-GTK was originally conceived by Andrei Zmievski, who is also actively involved in the development of
PHP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by The PHP Group. ...
and the
Zend Engine
The Zend Engine is a compiler and runtime environment for the PHP scripting language and consists of the Zend Virtual Machine, which is composed of the Zend Compiler and the Zend Executor, that compiles and executes the PHP code. It was origin ...
. 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
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ser ...
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 an
GtkHTML PHP-GTK 1.0 was released in October 2003 alongside several extensions — including a wrapper for libglade, which allowed the cross-platform
Glade
Glade may refer to:
Computing
* Glade Interface Designer, a GUI designer for GTK+ and GNOME
Geography
*Glade (geography), open area in woodland, synonym for "clearing"
**Glade skiing, skiing amongst trees
;Places in the United States
* Glade, Kan ...
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
A source-code editor is a text editor program designed specifically for editing source code of computer programs. It may be a standalone application or it may be built into an integrated development environment (IDE) or web browser. Source-code ed ...
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.
The project is only compatible with
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free and open-source cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both free and propriet ...
2, not version 3.
WxPHP
wxPHP stands for "wxWidgets for PHP" and is a PHP extension that wraps the wxWidgets library, which allows writing multi-platform desktop applications that make use of the native graphical components available to the different platforms. It supp ...
(
WxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
for PHP) exists as an alternative to develop GTK PHP applications.
Example
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
Callback may refer to:
* Callback (comedy), a joke which refers to one previously told
* Callback (computer programming), executable code that is passed as a parameter to other code
* Callback (telecommunications), the telecommunications event th ...
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.
See also
*
wxPHP
wxPHP stands for "wxWidgets for PHP" and is a PHP extension that wraps the wxWidgets library, which allows writing multi-platform desktop applications that make use of the native graphical components available to the different platforms. It supp ...
, PHP bindings to
wxWidgets
wxWidgets (formerly wxWindows) is a widget toolkit and tools library for creating graphical user interfaces (GUIs) for cross-platform applications. wxWidgets enables a program's GUI code to compile and run on several computer platforms with mini ...
* PHP-Qt, PHP bindings to the
Qt toolkit
Qt (pronounced "cute") is cross-platform software for creating graphical user interfaces as well as cross-platform applications that run on various software and hardware platforms such as Linux, Windows, macOS, Android or embedded systems wi ...
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
External links
Official websiteCommunity siteBrazilian community siteGithub repositoryRPGETv6 Beta Tool to encrypt PHPGTK Sourcecode
{{DEFAULTSORT:Php-Gtk
PHP software
GTK language bindings
Widget toolkits
Discontinued software