PHP-GTK is a set of
language binding
In programming and software design, a 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 ...
s for the
programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
PHP
PHP is a general-purpose scripting language geared towards 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 software 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 software, free and ...
graphical user interface
A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(GUI) applications to be written in PHP. PHP-GTK provides an
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impl ...
interface to GTK classes and functions. PHP-GTK partly supports GTK2, but GTK3 is unsupported.
History
PHP-GTK was originally conceived by Andrei Zmievski, who is also actively involved in the development of PHP 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 origi ...
. 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 Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
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
GUI widget
A graphical widget (also graphical control element or control) in a graphical user interface is an element of interaction, such as a button or a scroll bar. Controls are software components that a computer user interacts with through direct m ...
s, such as
Scintilla Scintilla (the Italian and Latin word for spark) may refer to:
* Scintilla AG, a Swiss electrical engineering company, a 100 percent subsidiary of Robert Bosch GmbH since 2005
* Scintilla (comics), a fictional character in the Marvel Universe
* S ...
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 Interface Designer UI builder to be used in creating PHP-GTK applications.
Zmievski and Fox continued to work on the project, with Fox maintaining PHP-GTK for Windows.
In 2008 PHP-GTK 2.0.0 was released to fully use PHP 5.2's powerful object model support, and to bring the improved portability of GTK 2.6, and 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).
Features
Source-code editor ...
widget. Around half the classes have been fully documented. Scott Mattocks, a member of the PHP-GTK documentation group, has also written a book on the subject of PHP-GTK programming.
In 2015 PHP-GTK 2.0.1 was released to be compatible with PHP 5.5 and GTK 2.24.
The project is compatible with only
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free software 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 software, free and ...
2, not version 3.
WxPHP (
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 no s ...
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 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 compiling applications written in PHP-GTK to a standalone binary executable. Alan Knowles' PHP Extension and Application Repository (
PEAR
Pears are fruits produced and consumed around the world, growing on a tree and harvested in late summer into mid-autumn. The pear tree and shrub are a species of genus ''Pyrus'' , in the Family (biology), family Rosaceae, bearing the Pome, po ...
) package
bcompiler also allows compiling PHP into bytecode to hide the source code.
See also
*
wxPHP
References
External links
*
Community siteGithub repositoryRPGETv6 Beta Tool to encrypt PHPGTK Sourcecode
{{PHP
PHP software
GTK language bindings
Widget toolkits
Discontinued software