1. PHP Dashboard Widget

    *blows the dust off his blog*

    Hi everybody!

    I've (yet again) let my blog become stagnant. I just can't seem to find the time/ambition to update it, regularly.

    Brief news: I switched to a Mac, a few weeks ago (more on this below), php|tek was awesome, and the latest podcast is up (thanks Sara).

    As I mentioned, I made the switch to Mac, a few weeks ago. It was relatively painless for me. There were a few things I needed to do to make it functional (set up pseudo-virtual-desktops, for example). I've been tinkering with all-things-Mac for a while, now, which leads to this post.

    I've created a dashboard widget that I find really useful, and I figured I might as well share it.

    Here's the link, but more after the jump: http://www.phpdoc.info/widgets/php.wdgt.zipI found myself using php -r on the command line to test some simple code snippets, and it occurred to me that this isn't "The Mac Way."

    So, following the excellent documentation at Apple, I managed to come up with something pretty useful in an afternoon.

    Note: you'll need to flip the widget over and set the proper PHP path, if it doesn't work out of the box.

    Let me know if you run into any trouble, and I'll attempt to fix it.

    Hope this helps someone. I find myself using it all the time.

    10 Responses

    Feed for this Entry
    • Nice idea :)
      I am not a big fan of dashboard, but I wll definitely give it a try. I do a lot of "php -r" these days too ;)

    • I did something similar with an AppleScript that I trigger with a key command from within BBEdit. It passes the current selection (or the current line if nothing is selected) to "php -r" and prints the output immediately below. The output is automatically selected, so it can be quickly deleted afterwards. It's very convenient for testing bits of code in place as I skim a file.

      I imagine this sort of thing could be done with many other text editors as well. But I'll also give the widget a try. It might be a nice addition to my workflow. Thanks for posting it!

    • Humm....

      How about a widget that you could drop the latest PHP source tarball onto and it will automatically compile and install?

      BTW, if you haven't already looked at it, try out TextMate. It is an astounding piece of software for a measly price.

    • Sweet! I'm adding this to my DB! Now all I gotta do is find space...

    • That wouldn't make much sense, as everyone has different requirements for compilation

    • Extending this idea. Does this mean it's feasible that PHP can be used to do behaviour for a widget?

      I say this because I'd like to develop something for my mac, but I'm not proficient in anything other than web-based languages. I'd feel comfortable trying it out in a widget if all the behaviour could be done in PHP.

    • cool stuff ;)

    • Anonymous

      2007 Aug 23 09:58

      Can anybody tell me what the path is for this widget on a standard install of mac os x please. I have PHP working and tried a number of paths (/usr/local/php5 and variations) but not getting any response from the widget

    • try this and it should work, its the full path to php

      /usr/local/php5/bin/php

    • Great thing this widget!

      And for everybody trying to find path to php: you can use nice command in ternimal - [b]which[/b]

      Usage:

      [i]# which php[/i]

      and you get something like:

      [i]/usr/local/bin/php[/i]