Building the Podcast Site with Slim PHP

Building the Podcast Site with Slim PHP July 1st, 2015, by Matthew Setter

Here we are in July 2015. How did the time pass so quickly? The excitement from the last few weeks is still with me, so you could say that I'm on a bit of a high of late. However, it's not all been peaches and cream...

Well here we are in July 2015. How did the time pass so quickly? That’s the second half of the year reached already. Anyway, the excitement from the last few weeks, both being accepted as a conference speaker, and starting my own podcast is still with me. Oh yeah! So you could say that I’m on a bit of a high of late. However, it’s not all been peaches and cream, as I like to say.

Whilst 85% of the work for the podcast’s been completed, perhaps more, I’ve been hit with a mild flu yet again, which means that the release date’s had to be pushed back. Ideally the latest date that it will be released is next Monday, the 6th July. It’s not something I’m keen have happen, but well, hearing a really raspy, husky voice, which potentially cuts in and out, won’t give a stellar first impression.

But it’s not all bad news though, as a lot’s been achieved so far in preparation for launch. The domain’s been registered, as has the Twitter account (@freeingthegeek, as @freethegeek’s already taken), and I’ve created a simple website, using a Twitter Bootstrap theme and PHP’s Slim Framework. So all in all everything’s, just about, ready for submission to iTunes, as soon as the first podcast’s created.

A Bit about the Website

Speaking of the website, I decided to build it myself, instead of using a prepackaged solution, like WordPress. I’ve wanted a technical project to work on for some time, nothing too large, which I can use as an opportunity to play with ideas and concepts I’ve been learning about. I wanted something real, something live, something which people will see, something which could affect my reputation, something which I have to be responsible for. This site fits the bill perfectly.

The design of the site’s not exactly rocket science, it’s a simple advertisement and lister for the podcasts, so that people know what to expect, both of the podcast overall, and from each and every episode. I feel that the net result is a nice example of how to create a site which does only what it needs to do, without going overboard.

Regarding the technical aspects, I built the site using PHP’s Slim microframework, and have been able to see just how adaptable and flexible the framework is. I’ve also been able to see just how far I’ve come from a software design and engineering perspective, within reason.

I’ve been able to learn more about some software development patterns, such as the adapter pattern, PHP’s Standard PHP Library (SPL), along with learning more about Slim’s implementation of Middleware. I chose to use Middleware to add Google Analytics support to the site.

Middleware’s not something I’ve used up until now. But now that I have, I’m definitely a convert. In this particular instance, Middleware makes it trivial to add content to a page’s response body, without conflating classes or mixing concerns. Definitely the way to go! Given how well it’s gone, I definitely need to spend more time expanding my knowledge by studying PSR-7 (HTTP message interfaces).

Note: If you’re considering a micro framework for your next project, definitely check out Slim!

Why Slim Framework?

Normally I might have, as a first point of call, turned to Zend Framework 2, as its been my default for quite some time now. But honestly, as the site is only 3 pages in size, Zend Framework 2 really is overkill. Additionally, I’ve been experimenting with and learning Slim for the last couple of months, mainly to help me automate another client project.

So it was an excellent opportunity to see what I could do with Slim. Plus, as the site’s out there for all the world to see, as well as the code, which is hosted on GitHub, I wanted to put extra effort and thought in – so I don’t get flamed.

A special thanks MWOP for an old post he wrote, 5 years in fact, which reaffirmed my approach with respect to filter and directory iterators.

The Code’s Been Reviewed

A good mate of mine, Chris from A6 Software, was kind enough to give the code a review for me and, on the whole, liked what he saw. However, he was also critical of the lack of tests and that I could have done more constructor injection. I have to agree. I was more focused on a prototype than a properly tested application. I’m planning to address that, as time allows over the coming weeks. So many ideas, and so little time.

It would have been great if I’d had more time or allowed myself more time. Alas, I haven’t. So I’m doing what I can with the time available. But, in time, the site will have solid test coverage I’m off to PHP South Coast this month, perhaps I should set myself a goal of having test coverage in place by then, just in case someone takes me to task at the conference. Speaking of PHP South Coast? Are you going?

That’s a Wrap!

Well that’s all from me till next week. I hope your week’s been at least as good as mine. All the best in your efforts.


Like That?

Don’t miss my next post. Drop your email in the box below, and get it straight to your inbox, PLUS exclusive content only available by email. No spam, and you can unsubscribe at any time.