LightMVC - A light MVC framework for PHP and mySQL

LightMVC - A light MVC framework for PHP and mySQL >marko.tkalcic@fe.uni-lj.si

Introduction

During the last years I've developed LightMVC - a stable and lightweight MVC framework for PHP/mySQL.

Features

  • MVC (model view controller) architecture
  • easy and fast configuration
  • mySQL connectivity (database abstract layer)
  • login/logout sessions
  • lightweight template system
  • PHP 5.0.X compatible

MVC architecture

The application is invoked using the index.php file which loads all the necessary components and calls the controller set by the GET parameter do.

Example: http://mypage.com/index.php?do=getAllFiles

will cause the framework to invoke the run() method of the ctrlGetAllFiles class.

All the controller classes reside in the framework/controller folder and should extend the baseController class. Every controller class name is composed by the ctrl prefix and the name of the cotroller set in the GET parameter "do" (from "index.php?do=getAllFiles" we get the class name "ctrl" + "getAllFiles" = "ctrlGetAllFiles"). Two important methods for the communication with the view are:
  • setView($view)
  • setParameter($key,$value)
All the model classes reside in the framework/model folder and should extend the baseModel class which offers high-level database methods like
  • getObject()
  • insertObject()
  • updateObject()
as well as low-level methods like
  • setQuery($sql)
  • doQuery()
  • getNextLine()
  • getLastInsertID()
The view classes reside in the framework/view folder and should extend baseView class. This class offers a method for extracting parameters sent by the controller:
  • getParameter($parameterName)
The view classes should make good use of a lightweight templating engine that is encapsulated in the viewTemplate class.

See the LightMVC manual for more info.

Wish list

  • support for handling XML files
  • support for SOAP client and server
  • support for form generation/validation

Download

The latest version of the framework can be downloaded here.

For questions, comments, wishes or bug reports please send me an email: >marko.tkalcic@fe.uni-lj.si.

License

Copyright 2000, 2005 Marko Tkalčič

LightMVC is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

LightMVC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with LightMVC; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA