[This article doesn’t explain how to built a Framework, but introduces CodeIgniter, the simplest fucking possible framework out there, at least from those i have seen. If you are looking into how to create a framework, just see spend some time to start reading the documentation. You will see that in 5 hours you will learn the whole system and you will be able to start using it! http://codeigniter.com/user_guide/toc.html. The article below tells all the story.]

Growing up as a developer I understood that I needed to organize my code a little bit. My older websites, their organisation, well it does not exist. Everything is a mess and no other man on earth can understand what is happening in there.

So I started looking in ways to do that. I listened to MVC, and I thought, great that is what I need. Then I searched a little to find something to use.

Then I found CakePHP. O my god what was that. I remember reading the tutorial and thinking “how the fuck I am going to remember all these ?”.

There is a milion Rules and convensions that you have to follow, for your code to work in CakePHP. Not possible to remember. I remember studing several days all those standards and shit they use. I was desperate. I thought, that is how MVC frameworks are ? I am fucked! I will spend less time building one of my own than learning all that shit. PROGRAMMERS DOESN’T LIKE MEMORISING ASSOLES!

Then I thought, ok well, let’s find some practical tutorial, built something, and learn CakePHP on the way. O my god what was that. I remember typing some magicall commands in the linux CommandLine and BOOM a working template application, HTML PHP FORMS everything.

And me thinking: What the hell did just happened ?

HOW THE HELL I am going to edit that thing and create my application ? Back to the fucking manual and the 1 million rules.

Well I thought, maybe it’s fast, faster than if I wrote one.

Well NOO!!

I actually noticed, when I open my browser to see what I created with the magical command line commands, that never before in my webserver I have waited this long to open a fucking simple page!

Not even Joomla! (Don’t get me started on Joomla).

I like writing my code man, not generate it with magical commands, then going up and down the filesystem to find the right fucking file to edit so that I can customize my shit.

So the decision was made: I will built my own MVC Framework. I will make it simple and fast like I wanted to. I started looking for tutorials or books.

Fucking dissapointment. There are no books, or I couldn’t find any, that give some guidelines on how to do that.

I can really program I don’t need the magical Framework to create the code for me (!!!!). I just want a simple way to seperate Presentation from Code, and built my code into Modules, so that I reuse them easily.

I hate the idea of programming things I programmed before. I want everything i write from now on, to be able to include them in a new website in the future, very easily.

Also one last thing I want is caching. Full page and database caching. I have some very big websites and without caching I would be lost.

So start from scratch ? As I was looking for tutorials. I found 2-3. The best and more viable is: http://oreilly.com/php/archive/mvc-intro.html. The same guy developed it a little bit and I accidentally found the code here: http://stu.mp/jax/content/source/Framework/. If that link dies someday, I have a copy so ask me for it (comment).

I didn’t like it because of many reasons. He uses smarty. Smarty, well is really bad, really slow, and except from the caching feature, is completely useless. I bechmarked a simple application with smarty, and a simple caching class I made. Smarty was 10-12 times slower … That is not acceptable … If you organize your code a little bit, you don’t need Smarty. PHP can do what Smarty does and a lot faster!

I actually looked into that Framework, and started developing it. Then one year later I copied my work to a new server to continue. What I didn’t like was that, well the code is very old (2005), and i got some deprecated errors! Not a good fature for a new Framework …

Also that guy uses a lot of PEAR libraries. I NEVER used anything from PEAR in 5 years I am programming PHP. I want to start something that is free of stuff I don’t need, and as light as possible. Loading a pear LOG class every time there is a pageview it’s not light, it’s heavy and I don’t need it!

Searching for another tutorial, I saw a comment on a post, about CodeIgniter. I saw that name a lot before, here and ther. I always thought that it was something like CakePHP, magical commands that create everything, and milion rules to follow, that if you don’t remember you can’t do nothing.

But hell no, this was best thing I ever saw when it comes to PHP. I read all the documentation in only 4-5 hours, I learned everything I can do with it, and it’s great, because it’s not so strict like CakePHP, you can do whatever you want.

Also is FAAASSSTTTT, it has built in database and full page cache and did I mention? VERY EASY TO LEARN!!

If you want a simple efficient complete MVC framework, USE THAT ONE.
If you want to built an MVC framework, please read CodeIgniter documentation first before you do it. And you will never want to create a new one, you will just use CI.
If you want to built an CMS (like me) do it on top of CodeIgniter!