It's been awhile since I've written. Summer is always a busy time with vacations and summer sports and dealing with four little ones at home. However school has started again and I'm officially "back to work".
Sara Golemon is one of the "Big Names" in PHP development, and one of my personal heroes for being a nice example of how women can succeed in open source and computers in general. Anyway, she's completely corrupted me. Now when I'm trying to write something and I can't get it to work, or want some kind of new functionality for PHP I keep thinking "I can make an extension for that..." Is this good or bad? I haven't a clue.
Now before I continue, just a qualifier. I like to work on windows - don't egg me. I use lots of the evil empire's products at work every day, and face it, some people do use Windows because they like the way it works. For me, I see windows as two entities...the geeks with their product, and the business sharks (that I don't really interact with). Also, the best way to get people interested in open source is to start introducing them to products on an OS they already know. Move them to firefox, thunderbird, and openoffice. Then swap out the backend for Ubuntu and they won't notice the difference in how "their" programs work. People hate change - remember? So make it gradual... Also it's never a good idea to bet all your eggs on one technology, whether it be linux, apple, unix, windows, commodore amiga... So I have several OS's running here at home and keep at least general knowledge on how to deal with all of them.
Back on topic. Writing desktop applications with PHP is considered to be idiotic by many people, but personally I think it's a lot of fun and can be useful. Using a scripting language for desktop apps means totally bypassing the whole compiler issue (we let PHP take care of "does this work on platform X"). Python has been in use for desktop apps for a long time, in many varieties... and though I could just go learn a new language, Python drives me a bit batty, with it's "some whitespace is semantic" stance (otherwise it's not too bad, I just personally don't like the syntax...totally subjective viewpoint...anyway).
I do some C# and could dive into some projects that way, compiling them to ride on mono or .net, but I really don't like compiling, even if it's to a format that can be passed around. The point is, I'm nuts enough to try to get PHP to cooperate with me. Also any idiot can learn PHP pretty easily (whether this is good or bad could be argued).
There are more solutions for desktop apps with PHP than people probably realize. I've been using php-gtk2 for quite a while, and actually learned C to help out on the project and am helping out with the windows end of things. There's also a qt4 solution in the works, and yes I've already volunteered to help with windows builds there...(yes, I am nuts). There's no Cocoa or wxWidgets wrappers...yet... (I can write an extension for that...)
Due to my "day job", I'm primarily concerned with the windows end of things, and having to install a toolkit layer to make your desktop show pretty windows can get really heavy. So why isn't there a Win32 GUI wrapper for PHP? Well, there is...kind of.
Winbinder plugs into the win32 API and allows windowing applications with PHP, however I have some real issues with the library.
- Started as PHP4 lib, just recently got a PHP5 port...and PHP5 dlls are never up to date
- Does not harness the power of PHP5 in any way, completely function oriented and the PHP end of the API is probably the most confusing, poorly designed I've seen.
- The developers have no idea of what help PHP5 can provide, have obviously never use PHP5 or understand how/what it's improved, and have no intention of moving to a nice OO API - so jumping on the project is out of the question (a lot of this probably has to do with backward compat... but since PHP4 has been end of lifed..what's the point?) There is an OO "layer" promised, but what I've seen so far is less than impressive
- The code is not threadsafe in any way, shape, or form - they use REAL GLOBALS...
So at the end of the day, I'm back to "I can write an extension for that." Prior art here included perl's wrapper for the win32 API, see I'm not the only weird one. So I am working on an extension currently called WinUi (really should be Win::Ui ...namespaces anyone??) ... it's still in progress, since the Win32 API has an enormous amount of junk I could add in, but the basics of window creation, moving, animating, and registering your own windows "classes" all work (and I've only been doing this about five days). - warning, that's a really large little movie (jing is pretty cool).
I'm loving the new features in PHP5, like the custom object support and intercepting setting and getting properties (you can do $window->size = 300 and use the right win32api call to change it ...all transparent from the PHP side of things) And although there's an issue with lack of documentation...I can always annoy Sara if I really hit a brick wall. (Thanks for putting up with n00bs)
Eventually I hope to have a WinUi, WinGdi, and WinSys (processes, threading, registry, et al) to put in pecl. There are some win32 only extensions in PECL, but win32std is the only one I've actually had use for, or even got working properly, and there's no agreement among them in naming convention, API design, or even functions vs. classes. So here I am, playing.
For now, give me a mail, ping if you want to play too and I'll stir myself to get the current code into source control or even throw up some (probably very rough) dll's to play with if you're crazy enough to help write tests/find bugs/grouch about the API design. And all you "My OS is better" zealots who will bitch about "Why are you bothering with this, we don't care about windows, and my toolkit/OS/extension is better than yours" - go jump off a cliff.
UPDATE: Started putting code up in SVN - give me a holler if you have patches, want to help code, whatnot, I'll throw up some test dlls shortly
Dreaming of Dawn








Matthew Turland
Hear, hear. :) I'm another multi-OS person and I too think that Windows has seen too little support in the PHP realm. PHP users who use Windows have been treated like bastard red-headed stepchildren and I'm equally tired of the presence of that stance in the PHP community. I hope your WinUi project goes a long way and possibly even to contribute to it myself one of these days when I get around to picking up C again. Good luck!
2007-09-08 8:54 am