MVC Framework for PHP5

I am currently writing an article about PHP5 and MVC frameworks for web programming for onlamp.com. Part of writing the article required me writing an MVC framework to showcase the theories and ideas behind MVC programming. The result is what I simply call Framework. The following are the installation instructions.


$ pear install "http://www.joestump.net/code/Framework/Framework-0.0.6.tgz"

As new version become available you can also use the above command to upgrade by replacing install with upgrade and the URL for the newly released version. Once it is installed check out /path/to/PEAR/doc/Framework for installation instructions and the article describing how MVC frameworks work.

You will also need Smarty installed in your path as Smarty/Smarty.class.php. Once that is done it should all work fine. Please feel free to email me with questions and concerns, however, this is not supported code at this time and not to be considered stable in any way.

UPDATE: You will want to check out the PEAR category on my site for the latest version of Framework, which is currently 0.1.1

3 thoughts on “MVC Framework for PHP5

  1. Hi,

    Your article at O’Reilly’s php devcentre does not contain the code for login.php.

    http://www.onlamp.com/pub/a/php/2006/03/02/mvc_model.html?page=3

    It just contains the placeholder “[code for modules/users/tpl/login.php]”. Can O’Reilly fix this? Was the editor asleep?

    The download from your site does not contain the example code either.

    I am just tracing through the code to switch it to DB::DataObject – i really like the lean and concise way with which you put together a nice productive OO-approach in php.

    Thanks for you effort
    */;-)

  2. Hi,

    It’s quite interesting. I like your Framework. I found it an “easy to learn” base to start building many different web sites. Before Framework, I was spending some days with Ruby/Rails, but finally didn’t like me (quite strong, but many effort behind scenes. I prefer more easy solutions, like yours). I’ve also tried other languages (Perl, JSP, C++ based CGI’s…) but nothing as easy as PHP, also for other platforms, like Windows.

    I’ve found some problems running the code. I’m using Ubuntu Linux with Apache 1.3 + php5. I relate them below:

    1- In index.php, __autoload try to load Log_File as g/file.php because of the str_replace, and then requiring it from FR_BASE_PATH.

    2- When I try with blabla.com/users/login, I get a notice about an inexistent userID value in the _SESSION. To solve this I’ve changed the 2nd if condition, in ./includes/User.php, to:
    if (!isset($session->userID) || !is_numeric($session->userID))

    3- Using includes/Presenter/debug.php I’ve found a problem using what in PHP Documentation is called “variables variables”. I’m not sure it it should works as you have written (i’m new with php5), but the documentation talks about left_valuable “variables variables” expressions, but not right_valuable. I mean, it looks like it is not possible to use $array = $$var;, because $$var is on the right side of the expression.
    I’ve changed to do a direct var_dump of each variable ($_GET, $_POST, etc).

    After that everything was fine.
    It’s a really elegant effort.
    Thanks.

Leave a Reply

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