Over the last couple years or so, my development focus has been on the .NET Framework and C# so, I’m sad to say, it’s been a while since I’ve written any “real” PHP code. I think the main reason for this is that I have been developing more and more desktop applications and less web applications. When I was writing web apps, I’d say my efforts were split pretty much down the middle between PHP and ASP. Then .NET came along with C# and I was hooked. I was able to continue to develop web apps but also transition to desktop development while using the same tools. C# definitely had an advantage here. But alas.. I always kept the candle burning for PHP, my old friend, and occasionally checked in on it’s progress. I was excited about the release of PHP5 and it’s direction toward a true OO (object orientated) Programing approach. Finally, PHP would include:
- “Real” Constructors
- Added Destructors
- Public, protected, and private properties and methods
- Data Protection
- Abstract classes
- Static properties and methods
- Exceptions, Custom Exceptions and Exception handling
This was a welcome change to PHP in my opinion. It’s true that with a little bit of work and an occasional hack, you could create classes and “sudo” objects in PHP4, BUT no matter how hard you try, it’s still not OOP. But even with all the improvements, PHP is still primarily used for web development leaving developers with the need to pick up other programing languages if they wish to venture into the desktop development arena. Right?
There is hope! Enter PHP-GTK. “What’s that” you ask?
Quote: PHP-GTK is an extension for the PHP programming language that implements language bindings for GTK+. It provides an object-oriented interface to GTK+ classes and functions and greatly simplifies writing client-side cross-platform GUI applications.
It is now possible to write functional windowed cross-platform applications for the desktop using PHP and GTK. ….HOORAH!! Originally released (ver. 0.0.1) in 2001, The project has progressed and come a long way. This is still a work in progress and there is a lot of work to do to make this comparable to other desktop development languages (C#, C++, JAVA etc.) but I am excited by the prospect. This puts PHP on the same playing field as the “big boys” and opens a whole new door of opportunities.
Today I finally decided to install the required pieces (GTK, PHP, a couple other packages) on my windows XP system and threw together a couple very small test apps. So far, so good!
Resources:
http://www.gnope.org/
http://gtk.php.net/
http://www.writingup.com/blog/phpgtk2
http://crisscott.com/category/php-gtk/