12
Win32API extension for PHP Cool Windows Stuff for PHP

Win32 api extension for php

Embed Size (px)

DESCRIPTION

My first talk ever, given at the Microsoft Web Dev Summit in 2007 Project is now winapiforphp on bitbucket

Citation preview

Page 1: Win32 api extension for php

Win32API extension for PHP

Cool Windows Stuff for PHP

Page 2: Win32 api extension for php

Aren’t Desktop Apps Dead?

• People aren’t always online• Some applications would be bandwidth

prohibitive• Some data is too sensitive to be passed

on the wire• Embedded OS’s don’t always work well

with websites• Browsers are just Quirky (I’m looking at you, IE6)

Page 3: Win32 api extension for php

PHP Advantages

• No Compiling• Instant Changes• No learning curve for a new

language• Plug into PHP extensions• Easy to Use• Fast to Write

Page 4: Win32 api extension for php

PHP Disadvantages

• Speed• Additional Extensions/Libraries

needed• Speed• Distribution (phar is helpful there)• Speed• Security

(do you see a theme?)

Page 5: Win32 api extension for php

So what are your options?

• PHP-GTK2• PHP-QT• PHP-WxWidgets (vaporware)• Winbinder (so not thread safe)• Win32API – Win::Ui

Who is your audience?Who is your audience?

Page 6: Win32 api extension for php

Things to Decide

• OS support (only PHP-GTK2 is truly cross-platform at the moment – you can even run it on Solaris if you’re insane)

• Distribution mechanism (you need to distribute PHP, your extension, plus your code)

• Upgrading• Security• Size

Page 7: Win32 api extension for php

What has gone Before

What *nix has that we don’t1. Semaphores2. Shared Memory (not shmop)3. IPC Functions4. Process Control Functions

Page 8: Win32 api extension for php

What’s Hiding in PECL

• Win32Std – resource files as streams, basic dialog boxes, registry access

• Win32service – services control• Win32scheduler – windows

scheduled tasks• Win32ps - PSAPI (Process Status

Helper) to get information • IISfunc - Provides IIS functions

Page 9: Win32 api extension for php

Reinventing the Wheel

Problems with Winbinder

1. Thread safety issues2. PHP4 style API3. No BC breaks allowed4. Few developers5. Differences in Direction

Page 10: Win32 api extension for php

So what works?

• PHP 5.3 target (we will release when they do)

• NAMESPACES• Intelligent, easy to use message

handling using callbacks• Locking CLI into a loop (modal process)

• Garbage Collection!!

Page 11: Win32 api extension for php

Beyond Thunderdome

• Goal is ALL (and I do mean all) of the win32api

• An extension system (similar to PHP’s extensions) that allow only the “modules” of the API you intend to use

• Low level system items (such as threads, processes, IPC) are the “core” and available in all SAPIS

• Some features (Win::Ui) are specific to certain SAPI’s (embed, CLI)

Page 12: Win32 api extension for php

Resources

• http://svn.bluga.net/win32apiSubversion repository

• http://gtk.php.netPHP-GTK2 Extension

• http://php-qt.orgPHP-QT Extension

• http://perisama.netWindows Builds for all kinds of PHP

stuff (win32api binaries to play will be here)