SleekMVC: Simple and Lightweight PHP5 MVC Framework

Article published Sunday, September 11th, 2011 at 12:30 am

I’ve begun work on a PHP5 MVC framework. Right now it’s about 50% complete, but in a usable state.

Why another framework? Well, I wanted to find a framework for the Ann Arbor PHP MySQL Meetup that I’ve been hosting, a framework that had a few specific needs. These needs are:

  • So easy to use, PHP beginners can use it (e.g. CodeIgniter)
  • Provide great documentation, explaining every feature (e.g. CodeIgniter)
  • Well-Structured and teach good OOP principles (e.g. Kohana)
  • Perform proper autoloading (Kohana)
  • Only provide classes for the most common/essential functions
    • Email
    • Caching (Memcache, APC, File)
    • Sessions
    • Database
    • Request (GET, POST, COOKIE)
    • Response (Headers, Output)

The goal of this framework is that a beginner could go through the code and comprehend the entire thing in a couple of hours (something that you can’t get from one of the bigger frameworks), keep the number of classes and features to a minimum to prevent a developer from feeling overwhelmed, and be scaleable enough to work for PHP projects of all sizes.

Check out SleekMVC on GitHub.

Hi, I’m Tom, and Renowned Media is my professional blog for web development tutorials. Traditionally, I’m a PHP/MySQL developer, but recently I’ve done a lot of JavaScript and Backbone.js development. Right now I’m really interested in Node.js and NoSQL technologies. I love developing on a mac and deploying apps to Linux servers.

Facebook Twitter LinkedIn Google+ 

Tags: , , ,

Category: PHP Tutorials

7 Responses to “SleekMVC: Simple and Lightweight PHP5 MVC Framework”

  1. Andre says:

    I’ll be watching it on github. currently working on something similar. Truly – if one to love a framework- one has to create it:)

  2. Justin says:

    I’m very interested in this wip. When do you expect documentation and other things to come?

  3. Howard says:

    Hi, I found your project via researching how to use php namespaces. (Coming from C, C++, C# background namespaces are not new to me. What is new is how php handles/uses namespaces.

    Anyway, I came across your blog where you detailed using your autoloader to load classes etc…) I downloaded your mvc project but could not get it to run as it seems to die in the controller_home::action_index on this assignment stmt: $this->cache->cachedValue = time();

    I realize its alpha code but being a noob, I’m trying to learn php and your project happens to be my first attempt at stepping through someone else’s code…as a learning aid…

    Any ideas of what I’m doing wrong?

    Thanks,

    • That line of code you could delete if you want, it shows an example of how to cache data.

      By default, the cache system uses a file based cache, and it writes the cache files to app/cache. Unfortunately, git doesn’t seem to upload empty directories, so that directory probably doesn’t exist on your system (I need to stick an empty file in that folder I’m guessing).

      If you simply create the app/cache directory and make it writable, it should run just fine:

      mkdir app/cache
      chmod 777 app/cache

  4. Jamie Stackhouse says:

    Hello! I’ve been playing around with SleekMVC now for a little bit, and I’ve been successful in building a few fun things with it, but I’ve hit a wall as far as understanding goes with the IDE helpers you mentioned somewhere in documentation.

    I’m using a 3rd-party library called Reform, (anti-XSS) and well I have been able to implement it and get it working, I am unable to get code suggestions in Netbeans for it however.

    I’d greatly appreciate any assistance you can give me, some additional information is available here..
    http://stackoverflow.com/questions/8705125/netbeans-php-code-completion-failing-me-or-am-i-failing-it

    Thanks again, I’ve learned quite a bit about PHP from your articles! :)

    • I’m really not sure why the Reform library you use doesn’t have code completion in NetBeans. If the class is inside of your SleekMVC app and the code is within the scope of the project in NetBeans, it should be working just fine (NetBeans, as long as it see’s the class within the file hierarchy, should “just work”).

Leave a Reply