PHPDeveloper.org Sees the Light – The Move to Solar

So I’ve been asked several times about the move I made for PHPDeveloper.org from the Zend Framework over to Solar with the main question being “why?”

Well, I hate to break it to any of the framework zealots out there but the only real reason I had for doing it was the old “try something new” idea that floats around every so often. Yes, I know the site was working just fine under the old Zend Framework code (and yes, I do mean old – I think it was a few versions before 1.0 even) but I get the itch to do something new every once and a while. Some people redesign – I’ve done that too – and others rewrite things from scratch.

I took the opportunity to really look at the core of the site, stripping out all of the extra little “goodies” that I’d hacked in to the ZF version to get various things working. I came back to the primary focus of the site – to provide the latest news information quickly and easily – and made sure that all new code pointed toward that goal. The overall concept is a simple one really: it’s essentailly a blog whos topic just happens to be the goings-on of the PHP community as a whole. All it really needed to do was show the news items, serve up a feed and provide an administrative way for me to add new posts to the system.

I developed the Zend Framework version many moons ago and I almost don’t remember how it was all set up. It took me a bit to get back into it to see how things were structured, but in the end, most of that was tossed and replaced wth some sleek Solar code.

One of the biggest things that I was happy with in the new rewrite was the way that the news information is fetched from a the database. There’s no longer function calls like “getMainNews()” or “getNewsDetail()”. Instead they were replaced by a fetch function that takes in parameters on the object (sort of like the Command design pattern) and applies them to the current query.

For example, I make a call to the “setProperties” function of the NewsAPI object to tell it that I want a type of “where” with a value of “ID=1234″. The fetch function then looks through the properties and applies the operation to the query. The result is a function that can be called the same way every time with the same sort of output. The only difference is in how much/what kind of output there is.

I was concerned about some of the performance issues I was seeing on my server when I made the switch. Some of it was my own fault – forgetting to cache the feed instead of geenrating it, not adding the spam/IP filtering to ward off some of the spammers – but there was still a slow down when the load started to get high. I knew Solar could handle it (it had done it wonderfully on the dev server) so it had to be something else. The dedicated machine I’d been using was nice, but was showing some of its age. I decided to buy a slice from Slicehost and set up shop over there with only PHPDev running on it. Turns out that it wasn’t the new Solar version that was the issue, it was the server. In fact, I’d almost be willing to not cache the feed anymore – the performance is that good.

My last little part of the transition is writing the backend command-line scripts that I use to do some automatic things and the site will be back and complete and 100% Solar-ized.

I know there’s some things I didn’t cover here, so if you have any questions, leave a comment or drop me a line: enygma at phpdeveloper dot org. I’m more than happy to talk Solar with you. And if you’re interested and want to chat with other Solar folks (including some of the main developers behind it), come over to the freenode network – irc.freenode.net – and pop in to #solarphp and say “hi”.

SolarPHP.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>