Bare bones MVC to provide controller/view structure

dev-master 2014-05-16 15:37 UTC

This package is auto-updated.

Last update: 2024-04-19 19:03:16 UTC


This is not fully featured MVC. This probably does not provide all the features you are looking for. In fact, this framework doesn't even understand the Model part of MVC. The entire purpose of this MVC is to provide as simple as possible framework for simplistic websites in order to have separate controllers and views and a sane way to link them on web pages using mod_rewrite.

If you need anything more, I would recommend something like Symfony 2.


In order to properly use this MVC, you should probably set up your .htaccess file to redirect all calls to the index file. For example:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)               index.php?path=$1 [L]

If you want to follow the default ideology of this MVC, you should have folders like 'controller' and 'view' for controllers and views. Then, create a bootstrap in index.php that should probably look something like this (assuming usage of composer):


require 'vendor/autoload.php';

set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . DIRECTORY_SEPARATOR . 'controller');

$mvc = new \Riimu\BareMVC\BareMVC();

For example of how the controllers and views are meant to be used, see the files in the example folder, which provides a working example.


This library is copyright 2013 to Riikka Kalliomäki