Sunday, January 17, 2010

PHP MVC Framework Recommendation

This question comes from Brandon M.

hey brother... I've delayed way too long about getting serious with a framework that follows the MVC pattern... do you have a framework that you'd recommend? PHP is my language of choice, and I've been eyeballing CodeIgniter, but your recommendation would certainly go a long way. Particularly, something that is very SVN friendly (as far as keeping the project intact and deployable to mutliple workstations/servers with minimal hassle)

Anyway, mostly in general just looking for a good recommendation on a php MVC framework?

Thanks brother, hope everything is fantastic with you!

If you're new to MVC, I say something like CodeIgnighter or CakePHP are the best choices. They offer a ton of functionality out of the box and have a pretty elegant implementation of MVC. I'm personally partial to CakePHP because of it's looser licensing and it the workflow seems to be more fluid than CI.

I've since switched over to ZendFramework for most of my projects as it offers much more flexability. Unfortunately, the learning curve for ZF is pretty steep (in the hockey stick range, to put it technically).

Be prepared to spend lots of time in documentation. Frameworks (like any new system) always require some upfront reading. You'll have lots of "WTF" thoughts, but just go with the flow.

Cake's documentation used to be horrendous, but has gotten quite good over the years (I recommend doing the blog tutorial to really see how everything works). CodeIgnighter has some great screencasts on their site (last time I checked anyway, which was a lont time ago). Zend, IMHO, has the best docs around ... though, I don't recommend you jump into ZF unless you've got some serious time you can spend up-front.

Readers: It's your turn.

Am I right? Wrong? Agree? Disagree?

Saturday, January 16, 2010

Smart Search

This question comes from Sean A.

Mike, do you know of any code or APIs for helping make a site's search feature more intelligent? I'm working on getting my site's search developed and I know later on as things go id like to make the search "smarter" as in it having an understanding of word relations  such as understanding that  'lumber' and 'construction" go together so fi i search for construction supplies it understands that lumber businesses are part of construction. Do you know how to go about finding a base or having something developed? I don't even know how to write the documentation for a prototype of it.

Smart searching is a pretty common problem in today's web applications. Essentially we take a typical narrow search term and broaden it a bit to include additional relevant results.

Probably the best way to accomplish this is to have a related terms table which can serve as an index for related search terms. So, using your example, 'lumber' could also be related to a search for 'construction', 'contractors', and 'carpentry'.

Behind the scenes, you would want to add these to the user's search query via OR.

SELECT foo
FROM bar
WHERE bar.keyword LIKE "%lumber%"
    OR "%construction%"
    OR "%contractors%"
    OR "%carpentry%"