Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Konrad Pilch
Konrad Pilch
2,435 Points

Hard time to learn Php OOP

Hi,

I have hard time to learn PHP OOP. I saw the treehouse basics, but it's not really useful much since Hampton doesn't use PHP OOP in a app or web. Like if I want to make a user account with OOP, how would I do that?

I read articles, outdated yt videos thats impossible to follow, but I can't learn it. Either i have a problem to understand it from the articles, or i can't find anything useful. Wgat can I do?

3 Answers

Kevin Korte
Kevin Korte
28,149 Points

I agree with miguelcastro2. Don't confuse OOP and PHP with Bootstrap and CSS.

Bootstrap is a framework for CSS, it has modules, elements, etc. OOP is a design methodology that would apply to many languages. Heck, even OOCSS is becoming a term used.

  • Laravel is a framework to PHP
  • Bootstrap is a framework to CSS
  • OOP is a design pattern.

If you know what OOP is, you should be able to see at some level how to use it's principals to organize your code. You can start as simple as you need to. If you go and venture to learn Laravel, you should start to pick up more design patterns, since Laravel is opinated, and has many "best practice" ways to do stuff, which is based on the OOP principals, you should start to see all of the pieces come together in the framework to build a complete PHP app. I'd recommend you learn Laravel, it's fun if nothing else.

Konrad Pilch
Konrad Pilch
2,435 Points

So if I learn laravel, after, i could make my own php framework? I'd learn how all works in deep right?

Kevin Korte
Kevin Korte
28,149 Points

No, not necessarily. Laravel has a bunch of "magic" to it. It makes doing a bunch of things super easy and simple for a dev to do. You could go through and read the Laravel source code, and that would help understand how to make your own framework.

I can use RoR and Laravel, but I can't write a framework of my own in either language. It's much akin to Bootstrap or Foundation....using them doesn't mean you'll be a CSS master once you know how to build a site with them. There is a bunch of magic that happens, but if you read the source code it might help you.

Laravel isn't there to help teach you to do anything, it's there to do a lot of the heavy lifting for you, using OOP principals.

Konrad Pilch
Konrad Pilch
2,435 Points

Uhhh, so by learning laravel, nd looking the code, i could do my framework then? Because I really want to learn a language to its full, like be a good programmer not only with frameworks. If I want to do anything, i could code it. Us be good as well but it seems ppl start with frameworks: p do I'll do thst nd read the code. Thank you

OOP is a way of thinking and it may take some time before you start to understand it. The more you code the more you will understand. I can't stress enough that you need to code as much as possible for all of these concepts to truly make sense. The PHP OOP course is a great start and then once you are done, do the Laravel course, because in that course you will be building a web application using PHP and the latest OOP technologies. If you can get through the Laravel course I think you will finish with a great understanding of OOP PHP.

Konrad Pilch
Konrad Pilch
2,435 Points

I do understand how it works, i just font kbow how to use it. So in laravel, I'll learn it? So after that basicaly I'll could do it by hand? I allways start to learn without frameworks, the hard way. Like I knew css before I went to bootstrap.

Nd coding nd i get it? Seem i hv to do more hand on: p hands dirty.

Konrad Pilch
Konrad Pilch
2,435 Points

I found an awesome article. If i talk form my experience, i learned quite a lot aboout it here in treehouse and on yt as well, but this here is th ebest i ever read .

If anyone wonders or maybe when helping others if sm1 asks the same question as me .

ANd thank you guys for constant helping me! I really appriciate it, i solved a lot fo chalenges thath ways and learned a lot of new things :)