Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me

Launched a new PHP framework - Simple MVC Famework

David Carr

Development Nova Framework Tools

I've been working on a new framework for quite some time, I've dedicated to release it for anyone to use.

I started building the framework as I wanted to start using a framework, when I looked at the choices of current systems they all look good but come with way too much baggage I wanted something much lighter that doesn't have a complicated setup.

I think this framework fits that, its big enough to not be classed as a micro framework but smaller then mainstream frameworks. Its smaller due to the small amount of included helper classes whilst its nice to have everything you can think of included into a framework a lot of the time there not needed.

The following classes are included by default

  • Database
  • Pagination
  • Sessions
  • Url

The framework uses an autoloader, only the used classes are loaded.

Simple MVC Framework is a PHP 5.3 MVC system. Its designed to be lightweight and modular, allowing developers to build better and easy to maintain code with PHP.

For further details on the framework see the Documentation

Installation is very simple

  1. Download the framework
  2. Unzip the package.
  3. Upload the framework files to your server. Normally the index.php file will be at your root.
  4. Open the index.php file with a text editor and set your base URL and database credentials (if a database is needed). Set the default theme and controller to be loaded.
  5. If using a Linux server edit .htaccess file and save the base path.

A simple example

Here's a very quick example of using the framework, I'll create a page that lists contacts stored in a database.

First create a controller call it contacts.php in /controllers/ A call the the parent constructor is made, this gives the controller access to views and models, set a method (index) this will run as soon as contacts in called in the URL.

Set the page title and call a method from a model then pass the array to a view.

class Contacts extends Controller {

    //call the parent constuctor
    function __construct(){

    //index methods automatically run when calling the class such as
    public function index(){

        //set the data array
        $data['title'] = 'Contacts';
        $data['records'] = $this->_model->getContacts();

        //include a view and pass in the array


Inside the models folder create a model called contacts_model.php again call the constructor then create a method and setup a db query return the records for the controller to use.

class Contacts_Model extends Model {

    //call the parent constuctor
    function __construct(){

    public function getContacts(){
        return $this->_db->select("SELECT firstName,lastName,email FROM ".PREFIX."contacts");


Next in the views folder create a folder called contacts in there add a file called list.php

The view will check if a key exists in the data array is it does its then used.

<?php if($data['title']){ echo $data['title']; } ?>
    <th>First Name</th>
    <th>Last Name</th>
    foreach($data['records'] as $row){
        echo "<tr>";
            echo "<td>$row->firstName</td>";
            echo "<td>$row->lastName</td>";
            echo "<td>$row->email</td>";
        echo "</tr>";

Visits for more information.</p>

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!


My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.