Pragmatism in the real world

Redirecting email whilst developing

One common problem whilst developing is that you don't want to send emails out to the client (or their clients!). Ideally, we want to alter our development environment so that this doesn't happen, but still allows us to test the contents of emails that are sent by our web applications. Windows On Windows, the mail() function uses SMTP over port 25. Unless you've changed your php.ini file, then it will try to connect to localhost… continue reading.

Determining if a ZF view helper exists

This is another one of those posts that exists as a record for me so I can find it again if i need it! If you need to know whether a view helper exists before you call it, one way is to write a simple view helper to tell you: class App_View_Helper_HelperExists extends Zend_View_Helper_Abstract { function helperExists($name) { return (bool)$this->view->getPluginLoader('helper')->load($name, false); } } You can then use it in a view scripts like this: <… continue reading.

Custom Zend_Application Resources

Sooner or later, you want to leverage Zend_Application better by creating your own resource plugins. This lets you reuse your initialisation work in multiple application that much easier and keeps your Boostrap class that much shorter! In my case, I wanted to create a resource for CouchDb that checked that the database was created and if not, create it. Creating your own plugin is easy enough. The obvious place is library/App/Application/Resource and a typical resource… continue reading.

Zend Framework on a shared host

When you deploy a Zend Framework website to a shared host, you usually cannot change the DocumentRoot to point at the public/ folder of the website. As a result the URL to the website is now http://www.example.com/public/. This doesn't look very professional, so we'd like to remove it. The easiest way, given a ZF project created using Zend_Tool is this: Create /index.php < ?php define('RUNNING_FROM_ROOT', true); include 'public/index.php'; This uses the index.php already created by… continue reading.

Speaking at TEK·X

I'm delighted to be able to announce that I'm speaking at TEK X in May, in Chicago. This is one of the big US PHP conferences and I feel privileged to be invited. I'll be concentrating on Zend Framework with a tutorial called "Building a Zend Framework application" and a talk on "Working with Zend_Form". After a couple of less technical talks recently, it'll be fun to dive into more technical content. Hopefully, I'll be… continue reading.

Pragmatic Version Control Using Git

I've recently been looking at different version control systems, specifically distributed ones like git, Bazaar and Mercurial. At IPC I was talking to Travis Swicegood about wanting to learn and he very kindly organised a copy of his book for me to review and learn from. I didn't know much about git at all before reading the book. I do now :) It turns out that git is fairly easy when you have a good… continue reading.

2009 in pictures

Like last year, my wrap up is mostly an excuse to show off some of the photos I took in 2009! January Other than the snow, The big thing that happened in January was that an article I wrote was published in php|architect. February We had daffodils in snow at the start of this month and then towards the end, the PHPUK conference took place. March Spring arrived in March. The Severn Valley Railway had… continue reading.