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

    Category: php


  1. Declaring Static Methods in PHP


    I was confused recently to realise that I had accidentally called a static method in PHP dynamically from another part of my code; I expected PHP to output warnings when this is done. On closer inspection I discovered that:

    • Static functions can be called dynamically

    • Dynamic functions generate an E_STRICT error if called statically

    This made a lot more sense when I thought about it a bit more and wrote some toy code:

    Read more

  2. Retrieving Data from Google Analytics API using PHP


    Recently I started playing with the google analytics API, looking at ways to bring analytics onto dashboards and generate simple reports from the data in there. Very shortly after I started to look at the API, I had working data retrieval, so I thought I'd share my experiences (and code!).

    Read more

  3. PHPUnconference Comes to Manchester


    I'm very excited to hear that the PHPUnConference Europe (@phpuceu on twitter) is coming to Manchester on February 19th and 20th! So excited, in fact, that I've rushed out and bought my ticket (for a whole £40, that's a good investment in my opinion). The event brings together the PHP …

    Read more

  4. 3 Ways to Access a Namespaced PHP Class


    After what felt like years of debate over the notation to use for PHP's namespaces, it seems like the feature itself has had relatively little use or attention since it was actually implemented in PHP 5.3. We're all used to working without it but using it does make code neater.

    Take this example (in a file called namespaced-class.php)

    Read more

  5. Keynoting at PHPBenelux


    Have you got your tickets for PHPBenelux yet? If not then I hope you will do so because I would love to see you there!

    I'll be delivering a keynote at the PHPBenelux Conference in Antwerp in January alongside my good friend Ivo Jansch. Between us we've got plenty of …

    Read more

  6. Google Analytics Accounts API


    I'm working with Google Analytics at the moment, to pull information about web traffic from analytics into another system. Google have excellent APIs and that makes this job much easier. I'm using pecl_oauth to authenticate users against their google accounts (see my post about using OAuth from PHP), but even after I have a valid google user, working out which analytics accounts they have access to and how to refer to them is a puzzle in itself, so I thought I'd share what I learned.These examples use pecl_http, since I have control of my platform and I find it easy to work with. I've tried to write this with explanations of the overall process in between the code snippets so hopefully this makes the process clear whether or not you will use exactly the same implementation.

    Read more

  7. Fetching Namespaced XML Elements With SimpleXML


    Recently I was working with some google APIs and needed to retrieve some namespaced elements from the result set. This confused me more than I expected it to so here's my code for the next time I need it (and if you use it too, then great!)

    I was reading from their analytics data feed API, this returns a few key fields and then multiple <entry> tags, each with namespaced children. The entry tags look something like:

    Read more

  8. Be My Guest for DayCamp4Developers


    This weekend I'm presenting at DayCamp4Developers, a virtual event comprising a full day of workshops for developers of all disciplines to improve their soft skills and move forward in their career. I get to attend since I'm speaking, but even after I've given my slot I know I'll be online …

    Read more

  9. Deprecated Methods in Pecl_Http


    I'm a big fan of pecl_http, which I use quite often as I work so regularly with APIs and on systems where I can get it installed, it's much nicer than PHP's curl extension. Recently though I've been often seeing output which reads:

    Function HttpRequest::addRawPostData() is deprecated
    

    It isn't …

    Read more

  10. Best Practices in API Design: Audio and Slides


    Earlier in the year I gave a talk at PHP UK in London entitled "Best Practice for API Design". I really enjoyed giving this talk, since I work so much with APIs and enjoy sharing my ideas. The audio is now online so if you missed the talk, feel free …

    Read more

  11. PHPNW10: Teach a Man to Fish


    Last weekend I gave a talk at PHPNW10 in Manchester, entitled "Teach a Man to Fish". This is a keynote about teams and how to use the resources around you to create a team where individuals and the whole team continues to learn and develop. The slides are not very …

    Read more

  12. Authenticating with OAuth from PHP


    I've been looking into OAuth recently and really like what I see, so I started looking at actually starting to play with something that uses it (and isn't twitter). In the pursuit of this, I spent some time walking through the process of how to actually authenticate using OAuth, as a client. I chose Yahoo!'s service, because they have some fabulous developer documentation and have a standard OAuth implementation. Although you don't strictly need any special libraries to handle OAuth, that would be a bit like decoding XML with a regex, so I used the OAuth Package from PECL. For others (including me after I've slept), here's an outline of the process.

    Read more

13 of 27