Saturday, January 16, 2010

Frameless PHP, or How to Write Ruby-on-Rails-like PHP Without a Framework

If you’re disciplined, you can write MVC code in PHP without using an MVC framework. The key is to have the right directory structure. For the Dowling's Wheel project I mentioned a couple of posts ago, I simply used the directory structure from Ruby on Rails. And no framework.

/app
..../controller
..../helpers
..../models
..../views
/db
/lib
/public
..../images
..../javascripts
..../stylesheets
/test
index.php

Check out the source code to see how it’s done.

4 comments:

  1. Always amazed that people so often think the only way to do MVC is through a framework. Nice to see someone talking about rolling something light weight.

    ReplyDelete
  2. I'm doing the same but with Pyton and webpy. Check this out:

    http://github.com/alexksikes/googlemodules

    ReplyDelete