Create your First Tiny MVC Boilerplate with PHP
videos

Create your First Tiny MVC Boilerplate with PHP

Tutorial Details
  • Topic: PHP / MVC
  • Difficulty: Intermediate
  • Estimated Completion Time: 14 Minute Video Tutorial

I’m often asked about how to create an extremely simple MVC boilerplate for small projects which don’t require a massive framework, like CodeIgniter or CakePHP. We’ll build a solution in ten minutes or so.

It’s important for me to note that I’m not advocating that you shouldn’t use large frameworks. They absolutely have their places, and I use them often. That said, there are definitely times when they can be overkill for smaller projects. When your only requirement is code organization, it’s typically better to scrape together your own MVC boilerplate.


Conclusion

If you enjoyed this video, and would like to take our tiny framework to the next level, we can definitely do so together. Let me know in the comments!

Tags: Videos
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Brian

    Nice, very nice. I would love to see this expanded, especially setting up pretty urls and CRUD. Any suggestions where to learn more about this without dissecting any of the complex frameworks out there?

    I have found surprisingly little tutorials as useful as this short video.

  • kevin

    Nyc tutorial, could you please expand it more so that it be more flexible and that it can include a CRUD like functionality.

  • JW

    Hey! Where is the 2nd part of this?!?!?! :(

  • Tim

    Does anybody know how to add another View to this? Really need Part 2 of this tutorial.

    • http://www.facebook.com/ribafs Ribamar Ribafs

      Add in home method from controller:

      $this->load->view(‘view2.php’, $data);

      And create the view2.php in views folder.

  • Simon Davies

    I must dito the others, would be nice to see a second part of this to include a htaccess/database class/CRUD etc something simple but explaining how it could eb taken further etc

  • http://mauromarano.it Mauro

    Hi jeff, very nice tutorial! It explain very well how common mvc framework works.
    Would be great to see more about this topic. I’d like to see how to grab and use URI to call controller’s action like in codeigniter, yii etc.

  • http://www.vueine.com vueine

    Very cool.
    Should be useful to my project.

  • http://jakir.me ?JAKIR!

    Great Great and Great tutorial !!!!!

  • Chris

    Hi,

    Great tutorial. I have just copied it letter for letter and when I run it I get a server error. Cannot see where I am going wrong.

    Any explanations as to what this may be?

    Thanks

  • syed

    Thanks Jeff.

    Its a nice little mvc example. I was looking for something like this. :) Thanks again. Cheers.

  • Nahuel

    Great tutorial!
    I’m following the CodeIgniter from scratch series, but i’m really interesting in knowing how to create a MVC fw if someday it’s necesarry.

    Please continue this video!

    Nahuel.-

  • http://xandesigns.com Alex McCabe

    Literally just started learning OOP PHP from limited PHP experience and spent all day trying to get something from the DB to display. I did it, but you make it looks so god damn easy.

    I would very much love to see the next part, if there is one. This is exactly what I need to use on my latest project.

  • mayank

    very good and nice post bro….

  • Dennis

    thanks a lot! Hope there’s comming more

  • Tamal

    I that’s a nice one. Video is awesome and simple. Hope there’s more coming soon

  • Brian

    So if I made a new function loading a view in the controller what would be the url to access this new page?

  • Bertram

    Hey! Is there going to be a second part of this soon? I thought this tutorial was really good, and it would be nice if you could share some ideas about what to do next with the mini-MVC.

  • perfektenschlag

    I would very much like to see a second part on this!

  • lordorczy

    Great eye-opener..especially for the daring programmers

  • Erik

    Nice short tutorial Jeffrey!

  • mitni455

    Great tute (as always) Jeffrey. Could you please cover ‘.htaccess’ for rewrites please?

  • Jan

    part 2!!!!

  • Nilpo

    Yet another unfinished tutorial on Nettuts. This is precisely why I don’t pay for membership. The comments on GitHub for this code say a second part was to be published but it never was.

  • Arnson

    This is great! Would love to see another one of these!

  • Adam

    Hi Jeffrey,

    great tutorial! I was just wondering how you would implement routing for the mvc as I am very keen on including it myself only don’t fully understand how the routing works. any help on this is much appreciated.

    Adam

  • Quang Vu

    Thank you so much for this tutorial. I am searching some solutions to build a tiny PHP MVC framework and yeah, this is exactly what I need. Thanks!