9: Load Classes Automatically In OOP PHP | Object Oriented PHP Tutorial | PHP Tutorial | mmtuts

preview_player
Показать описание
In this OOP PHP tutorial I will show how to load classes automatically, as soon as you instantiate a class. This saves us a lot of trouble in regards to having to update out "includes" and links all the time.

NOTE:
In this video I say that "_autoload" would get "depreciated", when I meant to say "discouraged".

depreciated = will get discontinued
discouraged = is not recommended

I know there are viewers out there that care a lot about proper phrasing and such, so I thought I'd clarify here :)

➤ GET ACCESS TO MY LESSON MATERIAL HERE!

First of all, thank you for all the support you have given me!

I am really glad to have such an awesome community on my channel. It motivates me to continue creating and uploading content! So thank you!

I am now using Patreon to share improved and updated lesson material, and for a small fee you can access all the material. I have worked hard, and done my best to help you understand what I teach.

I hope you will find it helpful :)

Рекомендации по теме
Комментарии
Автор

NOTE:
In this video I say that "_autoload" would get "depreciated", when I meant to say "discouraged".

depreciated = will get discontinued
discouraged = is not recommended

I know there are viewers out there that care a lot about proper phrasing and such, so I thought I'd clarify here :)

Dani_Krossing
Автор

I can't imagine someone who can teach coding with simple and clear explanations like you. When someone understands the 'WHY', he can explain anything. If not, he will resort to repeating incomprehensible puzzles.

wadiibounenni
Автор

One thing worth mentioning, if your server is running on Linux, you need to make two adjustments to what Dan has done in the video. Firstly, as Linux (unlike WIndows) is case sensitive, if you are calling your classes with a capital letter (eg. Person, rather than person, like in the video), you need to also make sure your class file is capitalised, eg. Person.class.php. Secondly, if using namespaces, you need to make a change to the autoloader function. As Linux uses forward slashes for file directories, you should add: $fullpath = str_replace('\\', '/', $fullpath); to replace the backslashes picked up with forward slashes. I believe even if you add this line, it will also still work on Windows anyway

bigdoggetom
Автор

keep going man i really enjoy each and every single episode you make

mhassan
Автор

Love your videos! You just have a way of explaining things so clearly, something that most of my teachers struggled to do, especially with OOP concepts. Thank you for your work and dedication!

kristapsvecvagars
Автор

I really hope you'll get many more subscribers, because even for someone who already "knows" OOP in PHP, your explanations are very clear and easy to follow.
You really ease the understanding of that core concept !

Thanks for these great courses !

francoisbourvil
Автор

You're the best PHP teacher. Thanks Dan

kelvezu
Автор

Great! Man your tutorials about coding in PHP are one of the best on youtube!

robertbajo
Автор

I was scaring to get into OOP php, when I was trying to understand it, my brain stopped working. But, you have eased all this, you teach in a very supercallifragilistic way.
As of now my brain has started working 😆😊 to understand php OOP. Thank you very much.

mh_reja
Автор

Man, thank you. Best instructing style that I've found out there.

mhc
Автор

Great content, and speech delivery is in a very high level, thank you man

syrymzhakypbekov
Автор

I love how enthusiastically you teach!

brunosastre
Автор

I learned a lot from you Sir. Dan, 9 more episodes to go! Thank you so much for the lectures

markgilsongregorio
Автор

This was a great PHP OOP 'good-housekeeping' lesson. Really helpful. Thank you.

richardwilkins
Автор

Wow man, you really have the talent to make a hard concept become easy, I appreciate your work and it is helping me a lot.Thanks for that!

guscostarock
Автор

Thank you so much for explaining it in such an interesting way that I'm watching it instead of Netflix on Sunday afternoon! :D

vladiklass
Автор

I am a new to PHP programming and have done too many procedural programming, actually I use procedural programming in our capstone project.
I've heard a lot in OOP and done some research about OOP and I had a hard time studying OOP until I saw your tutorials about OOP(PHP) it is easier to understand the way you explain things.
Thank you so much.

powpowalemany
Автор

Best php channel. Good job Daniel, good job

_timestamp
Автор

I've been coding for something like 6 years now (front end) and there's a handful of areas where my brain never quite clicked. MVC in PHP is one of those areas. I have realized over time that my brain needs the conceptual explanation, the abstract high level overview of things instead of just the explicit instructions on implementation. If I understand the idea of how it's supposed to work, I can figure out the implementation. All this is to say I really love your style of teaching and that you focus on the concept and not just the implementation. Cheers!

tictac
Автор

Perfect as ever! For a little bit of finesse in production (and to hide anything useful to a hacker) you can change _return false;_

to an error handler:

die("Error - Please try again later");

or an error code, or whatever works best for your project.

robustreviews