This website recently got a major rebuild; if you're missing something, let Lorna know.

    Category: php


  1. Speaking at CakeFest 2012


    image1I'm delighted to announce that the nice people over at CakePHP have very kindly invited me to speak at their event in Manchester in September - CakeFest! They brought this event to Manchester last year and I wasn't able to make it, so I'm super-excited to be there this year.

    Read more

  2. PHP 5.4 Benchmarks


    Today I'm giving my first ever talk at OSCON - about PHP 5.4 (I'll also be giving my second ever talk at OSCON, about RESTful services; it's a busy day!). My talk includes some benchmarks which I thought I'd also share here.

    Read more

  3. PHP's Magic __invoke() Method and the Callable Typehint


    PHP has a variety of magic methods; methods named with two underscores at the start, which get called automatically when a particular event happens. In PHP 5.3, a new magic method was added: __invoke().

    Read more

  4. Bit.ly API: Bundles and Short URLs


    I am a huge fan of bit.ly and use their tools for a wide variety of different things. They recently did a big relaunch with some lovely new features, which are for the most part pretty good, but which are inaccessible in places. In particular, it seems that there aren't any short URLs for the bundles - which is annoying for me as I use that feature a lot!

    To get around this, I used their API to make a page which lists my bit.ly bundles, and creates shortlinks for each of them (once you've created a shortlink for a given URL once, bit.ly just re-uses the same ones the next time you ask to shorten the same URL, so this is less silly than it sounds).

    In case the code is helpful, I thought I'd share.

    Read more

  5. LAMP and Beyond, 30th June in Manchester


    Just wanted to share news of an event that I'll be at in a couple of weeks: LAMP and Beyond. This event is organised by PHPNW and held at Madlab in Manchester on June 30th (it's a Saturday).

    The idea is that we bring together a bunch of interested developers …

    Read more

  6. Proof that PHP 5.4 is Twice as Fast as PHP 5.3


    So recently I was working on some benchmarks for different versions of PHP, because I heard that PHP 5.4 is "faster" and since I'm a data geek I want to know how much faster! Now, PHP 5.4 is, in general, faster than PHP 5.3 but not twice as fast* unless you pick a use case which has been particularly optimised.

    My first attempt at benchmarking the two versions produced this:

    graph showing php 5.4 taking half the time of php 5.3

    Read more

  7. Fetching Your Talks from the Joind.In API


    I'm a regular speaker at a variety of (okay, mostly technical, so not really that varied!) events, and I submit talks to many CfPs (calls for papers). Whenever this happens, I tend to look back at whether I have any existing talks that I gave and liked and which would be a good fit. I use my joind.in speaker page for this: http://joind.in/user/view/110 as it's simpler than dredging through my directory of talks/articles on my hard drive (this is now rather large and unmanageable!).

    I've recently been thinking that I should also do a better job of linking through to the various talks I'm giving/have given - and at around the same time I was contacted by the good folk at mojoLive about integrating against joind.in. To cut a long story short, the joind.in API now has the functionality for users to retrieve their list of talks!

    Read more

  8. PHP Recursive Function Example: Factorial Numbers


    I spun up the simplest example I could think of to illustrate a recursive function to a PHP beginner the other day, and I thought I'd share. I often don't post really basic content but I should - people are beginning to be beginners all the time, after all!

    Read more

  9. Speaking at OSCON 2012


    In July, I'm speaking at OSCON. Actually I have a few interesting speaking engagements coming up, and I haven't got around to adding upcoming dates to my blog yet but I'll be at phpDay in Verona next week with a talk on API Design and DPC in Amsterdam in June with a tutorial on Web Services and a talk on what OAuth is actually for.

    OSCON is special because I have always wanted to go and never imagined it would actually happen. Every year I read the list of sessions from the year before, and decide that I absolutely must submit to the call for papers, regardless of how small I think my chances of being accepted are! I've submitted a couple of times in the past, excluding last year because I was newly freelance (OSCON does not cover any speaker expenses at all, they just give you a conference pass. That's kind of hard going for those of us self-funding halfway across the world, and last year, I just couldn't do it. This year I still can't really justify it but I'm going anyway!)

    Read more

  10. Using an Existing Vagrant Setup for PHP Development


    I've been hearing great things about puppet, chef, vagrant, and friends for a while now, but since I work on my own I tend to either develop straight onto my ubuntu machine or grab an appropriate existing VM and use that. So I read about this brave new world of virtualisation but (as with most tools) they can be hard to introduce on your own, and I didn't.

    Then I went to WhiskyWeb, which had a hackathon. I'm unclear on exactly what happened because my attention was elsewhere but it seems like @JayTaph showed off puppet and vagrant to @deizel*, who immediately built a vagrant setup for joind.in, which is an open source project that I'm currently leading. With the shiny new technology all packaged for me, I decided it was time to take a look!

    Read more

  11. We Don't Know Deployment: A 4-Step Remedy


    Someone emailed me recently, having read my book and wanting some advice. Here's a snippet of his email:


    So here's my problem.
    We dont know deployment. We work from same copy on one test server through ftp and then upload live on FTP.

    We have some small projects and some big collaborative projects.

    We host all these projects on our local shared computer which we call test server.
    All guys take code from it and return it there. We show our work to clients on that machine and then upload that work to live ftp.

    Do you think this is a good scenario or do we make this machine a dev server and introduce a staging server for some projects as well?

    I wrote him a reply with some suggestions (and my consulting rate) attached, and we had a little email exchange about some improvements that could fit in with the existing setup, both of the hardware and of the team skills. Then I started to think ... he probably isn't the only person who is wondering if there's a better way. So here's my advice, now with pictures!

    Read more

  12. Book Review: MongoDB and PHP


    Despite having been toying with MongoDB and PHP for quite a while, I've only just picked up and read the "MongoDB and PHP" by Steve Francia, published by O'Reilly (disclaimer: I've collaborated with Steve on a few articles and he sent me a copy of the book to read)

    Read more

8 of 27