First off, what IS this PHP-GTK anyway?

It is an application programming interface (API) that allows you to develop GUI applications using PHP and it's object-oriented programming concepts. It uses the The GIMP Toolkit, created by the makers of the popular graphics editor GIMP.

Why would I want to make GUI apps in PHP anyway?

Why not? PHP is already widely known as a web language used in developing web applications, and it is also used as a scripting language on the command line. It's fun for a PHP programmer to be able to create GUI applications with PHP. And all programmers program for fun (well, they should, at least).

How do I get started?

First, let's assume you are using Windows have PHP installed in C:\php. Now, let's visit the PHP-GTK website, specifically the download page.

[url]http://gtk.php.net/download.php[/url]

Download the latest Windows binary, which, as of now is 2.0.*

[url]http://gtk.php.net/do_download.php?download_file=php-gtk-2.0.*-win*2-nts.zip[/url]

Once you've downloaded it, extract the folder named php-gtk2 to C:\php. Your directory path should look like C:\php\php-gtk2.

Now, create a .php file named test.php inside of the php-gtk2 folder. Put this code inside of the folder:

[PHP]<?php
// Create the window
$window = new GtkWindow();

// This insures a clean exit when the app is closed
$window->connect_simple("destroy", array('Gtk', 'main_quit'));

// Labels can be text. This one is just a simple sentence
$label = new GtkLabel("Testing PHP GTK * 2 * 2");

// Here we are changing the size of the window to *00x*00
$window->set_size_request(*00, *00);

// The label is being added to the window, so you wil see
// the text in the our previous label inside the window
$window->add($label);

// This actually will display the window to us
$window->show_all();

// This keeps the window displayed (like a loop) and it is required
Gtk::main();
?>[/PHP]

Now, open up Command Prompt. Go to Start, then find the Run button. Click it, and type 'cmd' without the quotes into the box. The Command Prompt box should come up, in all of it's dark and ill-foreboding glory.

Use the 'cd' command to change your current working directory (CWD) to C:\php\php-gtk2. Then type this:

php test.php
A simple *50x*00 textbox should appear with the words "Testing PHP GTK * 2 * 2". Congratulations, you've made your first GUI application in PHP!

Okay... Making little textboxes is cool and all, but I wanna do more!

I'm afraid I cannot cover all aspects of PHP-GTK here. There's a limitless amount of things that can be done with PHP-GTK, and if I went over them all here, this would change from a tutorial into a PHP-GTK user manual. But don't fret, because below I've given the best resources on PHP-GTK that Google can find!

PHP+GTK2 Cookbook - This gives tons of examples, and is a great place to see how to do a specific task in PHP-GTK
[url]http://www.kksou.com/php-gtk2/[/url]

PHP-GTK Documentation - If at first you don't succeed, read, read the documentation. Not to mention the search bar at the top of the page allows you to search for a specific function (just like the PHP.NET website)
[url]http://gtk.php.net/docs.php[/url]

I hope you've enjoyed this tutorial and learned something!
~Moonbat