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
  • AlexFBM

    Great tutorial. I would be happy to see more of tinyMvc. Thanks so much!

  • http://www.clauddiu.com/ Claudiu

    Excellent tutorial, I look forward to see more of this.
    Thank you!

  • Vyer

    I’ve subscribe to you on youtube hoping to see more of these tutorials. Thank you so much!!!!!!!!!

  • Still Waiting

    Hurry up! Where’s the second part of the tiny MVC.

    I want it NOW!

  • erminio ottone

    a mvc tiny framework in php isn’t cool, you know what’s cool? a mvc not supertiny framework in js! or maybe some tuts about backbone.js..

  • Remo

    This is a great tutorial. Very useful. If anything I would love to see a database class implemented. I mean, using a MVC model is useless if data isn’t passed around.

  • Duncan

    Yes, we want more. Great tutorial Jeff, would be great to have some more, trying to get back into PHP after a year out – concentrating on .NET.

    This is useful not just for creating a tiny MVC, but as a way of learning how MVC works in PHP; I built a MVC pattern following a guide in the past, but out of touch with it.

  • Exequiel Navarrete

    Take it to the next level! Nice tut!

  • charles

    Nice one Jeff, Yes we want more!!!! this was very helpful, i have been looking for something like this for a while. thanks alot…

  • Muhan

    Wow Jeff,

    I have seen many of your tutorials, I always love them all. tinyMVC is a good foot print how to think a framework can be done!, it’s like a building started from a small block.

    This framework can be of great deal, & can be put next level. I love to contribute if i possible on the next levels.

  • http://www.designpalatset.se/ Kenth

    Good tutorial for better understanding of MVC with PHP. Allthough, it would be nice to see your approach of extending it just a little bit more.

    Thanks!

  • Alex

    Thank you for the tutorial. It really helps beginners who wants to learn MVC.

    I just wonder if there will be a part 2 of the tutorial to see how you would handle GET and POST, and SESSION …

  • Chris

    Do you have vim auto-suggesting? (and if so how) Or are you just hitting Ctrl-n?

  • Kyle

    I really enjoyed the tutorial.

    May be you could expand it a little showing how to use PDO or Doctrine in order to access databases?

  • http://www.cleantags.com Sergio

    Great tutorial Jeffrey, but please keep doing more advanced PHP tuts :) …or maybe come up with part 2 of this and make some core objects to work with the framework, maybe show how to implement lazy loading, or just make a nice DAO and ORM for this and it would be a total hit. Anyway good job and keep them coming.

  • Macovei Cristi

    Good job!!!! Part 2, please? :)

  • http://www.rahulprasad.com Rahul Prasad

    Everything went over my head.
    Gotta watch again.

    I was hoping some kind of explanation of what we are going to do before just jumping over to coding.

  • Mike

    Oh Jeffrey – you go so fast! And you assume so much prior knowledge. I’ve watched this about 5 times now and I still don’t get it. How does someview.php appear at all? There are no echo statements. What is the key bit of code that puts the view on the screen? Can anyone explain that to me?

    • http://www.jeffrey-way.com Jeffrey Way
      Author

      You’re right – this particular tutorial does assume some prior knowledge of PHP and OOP. The key bit of code that puts the view on the screen comes from the load() class.

      • Mike

        Thanks for responding Jeffrey. The Load class only has one function called view and it extracts the data. I guess the include statement calls the page. Putting an include statement inside a function knocks me sideways! Never occurred to me that you could do that. Is it normal practice?

  • http://www.solaerawebdesign.com Rosalind

    Very useful tutorial! This is a great side tut to watch while learning CodeIgniter — a little insight into what’s going on behind the scenes.

    I’d definitely be interested in seeing more tuts in this series.

  • Fahd

    Wow! very interesting tut! it helped me a lot.

    Thanks Dude!

  • Bo

    There are plenty of beginner tuts out there. I don’t want Jeffery to change anything about his presentations.

  • http://www.mediafirehunt.com/ mediafirehunt

    thanks a lot very very usefull to me…

  • Thomas

    Very nice tutorial. Hopefully someone can do one for ASP.NET 2.0.

  • http://promotiveit.com dede

    Great tutorial! It’s really useful because I was tending to install CI for whatever project size. Like everyone else around, I want more!!!

  • Kevin

    Very helpful, thanks!

  • Luis Milanese

    Do we want some more? Oh yeah. Please, bring it in. :D

  • Иван

    Wow – how wierd that I was thinking about how useful a MVC boiletplate would be while moddifying my own version of the html5 boilerplate!

  • http://e-kampung.com hasan

    very nice tutorial…. i like it.

  • Steven

    Awesome tut! Can we get a part 2 please?

  • jermaine

    great tutorial, but i would love to see a part 2 on how u could extend on this, cause am a newbie to mvc

  • jermaine

    could u please build a part 2 for this and show how u would navigate from page to page pls, or email me a source file at jermainemaragh@gmail.com

  • Derrick

    Great tutorial — very much appreciated, but
    does it have to be a video? I’m usually listening to music when I’m at my computer, and I love having the option of skimming paragraphs or re-reading sentences as necessary. If text works, why go video?

  • http://blog.silasolatayo.com Silas Olatayo

    Very nice tutorial.
    I like it!

  • http://www.socialmediadevelopment.org maragh

    any update on this project, id love to see a party 2…. thats one of the reasons why i join and pay for a subscription

  • http://www.nuntadj.org Alexandru

    Can you please take this in to the next level?

    MVC for universal project… (tiny but powerfull)

    Please :D

  • Ian

    Hi Jeffery,

    I am a premium subscriber and have got a lot out of the html, css, and jquery series for presentation. I looked around at samples and tuts for days and should have known to come here and look for mvc on nettuts.

    Your tutorials are awesome and even when it’s a little over my head I always understand what you are doing by using the pause and coding along with you.

    I would love to see how to include a pdo class and do some abstraction as those are the two missing pieces I’m looking for now.

    I think it is a great tool for understanding mvc even if the project gets big and a pre-made framework is more feasible. It would be great to take a tiny project and create the full blown mvc framework as if it was a big project and other frameworks didn’t exist. So, anything you can add to extend this would make another great series.

    Thank you!

    • brian

      I second that!

      It has been over a year though since the tut was released …

  • http://www.phpcourse.in PHP Training Mumbai

    hmmm.

    That is wat i was looking for MVC.

    Nice one hey submit one more article with database also.

    Thank you

  • David

    Very nice, finally made me understand the MVC model, i would like to see a follow up how to process the nice url’s with htaccess …

  • Julius

    How can I extend the load class so I could load in to controller class that I have already written?

  • J Roc

    Thanks, nice work… .htaccess redirecting and using the variables from URI next please!!!

    Cheers

  • omars

    Simply excellent…

  • Centurion

    Jeffrey, is there any change you will do an extension of this stuff? I mean, are you thinking or no about that, at least?

  • http://wearejh.com Adam Paterson

    As always a great tutorial!

  • http://www.jorisvanrijn.com Joris

    Awesome tutorial! I’ll be happy to see more (:

  • http://www.piitindia.com On Job training pune

    Nice post on MVC. So please be in touch for such valuable post.

  • Felipe

    This one awesome tut! Looking foward for the next ones expanding the tinyMVC

  • John

    Great tutorial, would love to see you take it to the next level.

  • Error404

    More about PHP pl0x

    • Carlo

      Will a part 2 be available pelase? Very great tutorial. thanks

  • Peter

    Hey,

    I would be very glad to see an part 2 of this article very soon ;)

    Thanks

  • Allard Jansen

    Great tutorial, I would like to see more about TintMVC. (I think I am not the only one)