Category Archives: php
Speaking at php|tek
- Practical SVN for PHP Developers – a half-day tutorial session I’ll be delivering jointly with Matthew Weier O’Phinney, Zend Framework’s Chief Architect, fellow subversion nut, and good friend
- Linux-Fu for PHP Developers – tour of the command line tools I use
- A Guide to Using and Understanding the Community – another joint session, this time with my colleague and friend Stefan Koopmanschap
If I survive that lot and the accompanying partying networking then I’ll be one happy girl. Wish me luck, and if you’re going – I’ll see you there :)
Published in php|architect
Book Review: RESTful PHP
, by Samisa Abeysinghe.
When I received and unpacked the book, it was a little lighter than I had expected, however REST really isn’t rocket science and can easily be covered in a tome this size. Overall it was well-written (with only as many spelling mistakes as any other PHP book) and clearly organised. The author begins by skating over why we don’t want to use SOAP, and shows his enthusiasm for REST as a replacement. However before the true elegance and concepts of REST are brought out and revered, we skip straight along and start to look at examples. Very few services that claim to be RESTful actually are, which makes writing anything along these lines very tricky, however I did feel the author could have been clearer about why having a single URL and a parameter for which action should be performed, doesn’t fit well. We do get a sense of excitement about services as ways to “glue together” bits of data on the net, and the possibilities of exposing and consuming information in this way.
Technical Content
Several frameworks are mentioned that can be used with REST, I’ve only heard of one (Zend Framework) – and this book works through a number of examples of working with Zend Framework to provide a REST service. The examples throughout are very thorough – starting with designing the service and getting the semantics of HTTP verbs sensibly applied. We are then taken through building the service using Zend Framework, creating a library class of functionality and then setting up the server to respond to incoming requests. For anyone using this book it is also worth checking for more up to date tutorials; Zend Framework has regular releases and some of the information in the book is already out of date – the dangers of the cutting edge!
Excess Baggage
On a personal level I’m not a big fan of frameworks; Zend Framework is a favourite but the use of it in this setting means that there is a large amount of the book dedicated to Zend Framework, the MVC pattern, and other things that aren’t really anything to do with REST. Call me old-fashioned but for me RESTful services need only HTTP and a data format of some kind, JSON or XML, and a good understanding of the grammar and structure of something that “smells” RESTful. In this book I got bogged down in the cookbook-style examples and lost sight of the bigger picture. The chapter summaries and best practice pointers though were great and I hope readers do take note of these.
Overview
If you need to build a RESTful service and you don’t mind Zend Framework, then this book will attempt to guide you through the process and explain plenty of useful stuff along the way. For a mid-level PHP programmer coming in to services for the first time, I consider this book a nice entry point. However if you were hoping to pick up the concepts behind RESTful services and look to apply them in your own work, then your $40 would be better spent on the RESTful Web Services from O’Reilly – you won’t be copying and pasting working PHP code, but you will come away with some great ideas.
PHP Advent Article Published
Zend_Paginator on Ibuildings Blog
PHPNW Post-match Analysis
On a personal level, I met up with lots of friends and also made several new ones – one of the best things about the conference for me was being able to meet “in real life” the friends I’ve made online, either on IRC or through my site or the phpwomen site. There were people there that I’ve met through my work and through attending other tech events – and to be able to shake hands and chat in person was great.
We also had a phpwomen stand at the event – which generated quite a bit of interest. For the record, we counted around 15 women in the 174 attendees, which is actually quite a lot – or rather, its more than usual – and it was great to see it. Also there were 2 female speakers out of 16 which was accidental but is also quite a good ratio so I’ll mention it (hi Steph, hi Zoe!)
All in all, it was a pretty stunning first conference – I’d like to personally thank Jeremy and the people from his family and company that he dragged in to help, and Jenny who also did a great job. The speakers were ace and the helpers on the day were also really excellent. The main sponsors were my employers, Ibuildings and it was great to have them around for this – and of course to catch up with my colleagues!
PHP North West Conference in Manchester – Next Week!
We’ve got socials happening right over the weekend – with a pre-conference social on Friday night for people to meet up, catch up, and generally hang out (and drink), the weekend will get off to a good start. Saturday is the main conference event, ticket price includes full access to the event, a year’s subscription to php|architect magazine (in print as well as digital format), lunch, and access to the evening party with yet more food (hotpot, since we’re in the north!), and of course a selection of drinks.
For those coming from further afield, there is plenty to do in Manchester over the weekend. The conference itself is very central, so you have easy access to the entertainments of the city centre. The shopping is excellent in the city centre and for those who prefer a geekier pastime, entry to the Museum of Science and Industry is free and it is open 7 days a week.
I know there are plenty of people going and I’m really looking forward to it – to catching up with old friends (and colleagues, I don’t see them very often!), to making new ones, to hearing the talks that will be going on, and of course to a few drinks and a good time. Hope to see you there :)
My PHPWomen Interview on Sun’s SDN Podcast
Locale-Sensitive Dates in PHP
In particular I needed dates like “Donderdag 23 Oktober”, and I was sure PHP should know how to do this without me creating arrays for days of the week and months of the year. With some help from my friend (thanks Derick) I discovered that there is a date function in PHP that takes into account the locale of the script, called strftime. The machine needs to have the locale already installed, then you can just do:
setlocale(LC_TIME, 'nl_NL.UTF-8');
return ucwords(strftime('%A %e %B',$publish_date));
Setlocale() will return false if the language isn’t available on the host system, so its possible to check and maybe try a few likely ones or let the user know. This was useful to me and will work for other languages too – you just need the locale installed and then set with setlocale.