Jump to content

my own mvc framework


Julius
 Share

Recommended Posts

Hi,

 

I'm trying to write my own php mvc framework, but I don't know where to start. I have been using codeigniter for a while, then i thought i shouldn't use it, because I'm not getting smarter when most of the code is written for me. So, writting my own framework would be a great practice to learn oop, i guess. I need: url routing, the would work like codeigniter's (http://website.com/controller/method/some/other/params) and calling some function for rendering layout files similar to codeigniter's ($this -> load -> view ( 'file.php' ); and not like this: $header = new Template ( 'header.php' ); then some coding with header, and same with content.php and footer.php). Can anyone please help me? Where to start? sorry for bad English

Link to comment
Share on other sites

The code in the tutorial does not show any MVC. It's just a piece of code, where some parts were given the names of "model", "view" and "controller" without any noticeable sense and understanding what they actually mean. Remember that naming something "observer" and "observable" does not give us the Observer pattern, if we do not implement the correct interactions between them. The same is with MVC.

 

Most of the current PHP frameworks (and Ruby on Rails that started the game) do not actually implement MVC, but one of its many derivatives, i.e. Model-View-Presenter with Passive View. I was working with MVC for a while, and believe me (or look for the original pattern definitions and check it yourself) - this is a completely different world from what we see.

 

In addition, if you want to learn OOP, I would throw away the outdated CodeIgniter code. I even wonder why people are still using this framework, if there are plenty of much better alternatives. Take a look at Symfony 2, which aims to set a completely new quality among the frameworks: https://github.com/symfony/symfony . You can also look at my experimental framework, where I make MVC experiments: https://github.com/zyxist/Trinity . First of all, try to understand the concepts behind them, and their structure. Writing a framework is not easy, at least if you want it to be usable :).

Link to comment
Share on other sites

This thread is more than a year old.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.