MVC and OOP in PHP


#1

Hey guys,

How do I get started with MVC and OOP in PHP. I have been looking for good tutorials and stuff on google but its all theory, no actual code is done. Also which do you consider the best for PHP. I feel like MVC is more for RoR (ruby on rails).

Any suggestions?

Thanks in advance

Taha Hesham

PS: At the moment I don’t want to use frameworks as im not a good coder yet.


#2

I find people overuse the terms MVC and OOP when talking about programming and although they do both have a meaning, obviously, quite often people’s understanding of them differs and their meanings can be interpreted differently. Sure, trying to understand these concepts and applying them where they make sense is a good idea but IMO it’s always best to follow your gut while sticking to good coding practices… Procedural, functional, OOP, whatever, the end user doesn’t care how you do it and the speed difference is minimal so it’s all about maintainability and your personal preference.
Also I don’t think one style is superior to the other, just different. :slight_smile:


Sorry that probably doesn’t help much, lol, I just thought I’d give you my opinion. :smiley:


#3

I am in the same position as you exept, in the news week i’m going to begin the MVC with Symfony (framework). Before that, I only did a few OOP php just to get the bases.

working with MVC without any framework, seem to me a little complicate, but maybe i’m wrong, i don’t have so much experience.

:wink:


#4

lol… I have no experience with any of them :D. Any tutorials out there to just let me know the basics & differences between each??


#5

Check out the new tutorial over on Nettuts It offers some good insights


#6

I would say pick a decent framework (ie CodeIgniter, kohona, etc… ), find some decent resources online (there’s plenty on most of the frameworks avail), and choose a fun project to apply what you pick up along the way… I was in the same boat a while ago wanting to dive into MVC and decided to run with PHP - landed on CodeIgniter - the end result was http://logpush.com/ a tracking tool for notifying users of updates to files.

I definitely learned a ton just diving in and utilizing the framework in all sorts of ways throughout the creation of the site. So I guess my recommendation would be to just pick a path, a project, and dive in - I had fun at least…


#7
I would say pick a decent framework (ie CodeIgniter, kohona, etc... ), find some decent resources online (there's plenty on most of the frameworks avail), and choose a fun project to apply what you pick up along the way... I was in the same boat a while ago wanting to dive into MVC and decided to run with PHP - landed on CodeIgniter - the end result was http://logpush.com/ a tracking tool for notifying users of updates to files.

I definitely learned a ton just diving in and utilizing the framework in all sorts of ways throughout the creation of the site. So I guess my recommendation would be to just pick a path, a project, and dive in - I had fun at least…

Jeffrey went over CodeIgniter & the basics of MVC during this series:


#8

I found OOP really confusing until I watched this series:

Very clear, and after watching that you really start to understand the benefits. There’s more to it of course, but the basics are still extremely useful.


#9

Umm. I do not know what you were searching for but there are tons of tutorials on creating your own MVC framework that include code samples on the web…

http://www.developer.com/lang/php/article.php/3829776/Build-your-own-MVC-Framework---Step-One-Getting-Started.htm

http://php-html.net/tutorials/model-view-controller-in-php/

http://www.google.com/search?hl=en&q=php+create+your+own+mvc+framework&aq=f&aqi=&aql=&oq=&gs_rfai=


#10

Hey! you can go for Zend which is for pros in my opinion. As for beginners codeigniter or laravel would be perfect. They are good to small to medium level applications. And they have small learning curve. I found this one helpful codeigniter tutorial series. It’s simple and good place to start with.

Good luck!