What is PHP-GTK?

What is PHP-GTK?

 

PHP-GTK is a PHP wrapper around the Gtk+ library. The Gtk+ library is a C library that lets a developer create elements on the screen that can react to user interaction. 

In many ways, Gtk+ is like HTML. Just as HTML tells a web browser where to place buttons, text, and other elements within the browser, Gtk+ tells the operating system where to place buttons, text, and other elements within the user’s computer screen. As a Gtk+ wrapper, PHP-GTK lets you create and control these elements using PHP code instead of the native C code. PHP-GTK takes something that would appear foreign to most PHP developers and make it more comfortable.

What would I use it for?

PHP-GTK provides a GUI for PHP scripts that run on the user’s desktop. It allows for multiple points of interaction by allowing the developer to create ‘on-screen’ elements that can react to the user’s actions. The need for a GUI should be pretty obvious for some applications. Picture trying to create a spreadsheet from the command line or even as a typical web application using HTML.

With other applications the need may be more subtle. Many developers have used PEAR to install and upgrade PHP packages. But not all these developers are aware that PEAR has a PHP-GTK frontend for managing packages (try running: pear -G). While the PEAR command line utility is very useful, it requires the user to know the commands they want to commit and the packages they want to use. The PHP-GTK frontend presents the commands and packages in such a way that it is not necessary for the user to know all the ins and outs of using PEAR or all of the packages they need.

Aside from providing a different presentation, PHP-GTK has another advantage over “regular” PHP. It is run client side. Any time that a problem calls for code to be executed on the user’s computer, PHP-GTK can be used. For example, managing an MP3 library would be difficult via a web based solution. With PHP-GTK the MP3s on the user’s system can be quickly organized and inspected without having to transfer files to a remote server.

Even though PHP-GTK runs client side, that doesn’t mean that it cannot communicate with a remote server. In fact, moving data processing away from the server using a PHP-GTK application can be a good way to save on server side resources. Think of reporting systems for a moment. Often times creating a report consists of collecting a large amount of data from a database, crunching some numbers for a while and formatting the output as a graph, table or maybe even a spreadsheet. The number crunching can be very resource intensive. Instead of doing this processing on a web server, which is designed to better handle remote customer requests, it can be done client side where resources are more plentiful. Displaying the results in PHP-GTK is no more difficult, and in most cases easier, than it is with HTML.

Another advantage of PHP-GTK is that the user does not have to initiate all actions. Web based solutions are request driven. This means that the user makes a request and the server responds. PHP-GTK applications on the other hand are event driven. This means that the application can react to more than just user requests. The application can process or transmit data in the background and inform the user when it is done.

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.