This was great and amazingly well explained. I previously didn't understood so much the idea behind dependency injection, but with this video is much more clear now. Thanks again Dave!
At Uni I chose to do a Developmental project and it was building a web service for an MSc course. I enrolled in Dave's API course on Udemy. The webs service was being consumed by Embassy websites. I tried several courses on Udemy and other sites only Dave's API course was helpful. It was also the shortest yet it covered everything I needed including detailed JWT Authentication. Dave's understanding of PHP is amazing, I guess he now dreams in PHP.
HI, the simplest and best explanation. Thanks. Now is missing a video about php as template system like plates, how organize using section / blocks or template Inheritance and base layouts. Please update your PHP unit course, which i already bought, to v10. And if possible, do first a video (overview) about Pest lib for testing and later on a full course on udemy. Thanks.
Thank you Dave. That was magnificent. I wish that your words during your presentation are captured as comments for each line. May I ask? The way you structured your psr-4 autoload setting: "": "sec/", will it still work if your Classes had namespaces?
@@dave-hollingworth sire 🙏 I'm having issues on php undefined array key in php _post when I want to submit a form please help me I have tried isset($_POST['userName']); also use myqli_real_escape_string but still showing undefined Array key on line......... When I submit a form
Hello Dave, I am still getting the Error: Uncaught ReflectionException: Class "string" does not exist. But then I realizing that my DAO class has a parameter with type PDO instead of the Database object, after I change the parameter type to database class object, it worked. But in cases like this where we just need to pass a method (returns the connection object) in the constructor is there a way to handle this with DI container? or is that even a good practice?
Hi, I wanted to ask a question, how do I resolve classes through DI that need runtime parameters? For example, if I have a UserService that in it's constructor will accept a User Model (say a User in Laravel), how do I inject this UserService as a dependency? I was thinking maybe I can have a setter injection instead of a constructor so that wherever I inject the class as a dependency itself, I call it's setter method to set the User for that UserService and then go through the logic I need to go through, is this a smart idea?
@@dave-hollingworth In the case where the parameters are runtime only, would you say it's better to use a setter injection (userService.setUser($user)) instead of creating a new userService and then passing the $user in its constructor? (new UserService $userService ($user))
In most cases it doesn't really make much difference, it's down to personal preference - although if you need to get a user object at runtime (e.g. as the result of an action like logging in) then it might be simpler to use setter injection.
Complete PHP MVC course: davehollingworth.com/go/phpmvc
i bought this in udemy. Keep updating sir
The way you explain such complicated topics is amazing 👏🏾
no doubt! he's a HUGE resource!!
This was great and amazingly well explained. I previously didn't understood so much the idea behind dependency injection, but with this video is much more clear now. Thanks again Dave!
Great Teacher!
I have 4 Udemy courses from him!
He Masters PHP! 😎👍
At Uni I chose to do a Developmental project and it was building a web service for an MSc course. I enrolled in Dave's API course on Udemy. The webs service was being consumed by Embassy websites. I tried several courses on Udemy and other sites only Dave's API course was helpful. It was also the shortest yet it covered everything I needed including detailed JWT Authentication. Dave's understanding of PHP is amazing, I guess he now dreams in PHP.
This is exactly what I've been struggling with to understand, thank you so much. Great explanation.
The PHP 🧙♂ wizard as always to the point with simple explanations. Loved it. Thank you.
thank you for create quality content and way you explain. keep it up
Excellent instructor and clearly very competent on the subject matter.
Please consider a course on using/accessing.a PHP application with SSO/Entra.
Dave is very X 3 excellent teacher.
Great, Dave, thank you
best!
Thank you Dave for all your tutorials. Do you have or plan for a Laravel tutorial?
Are there any new full tutorial coming? and thanks again
No plans for a Laravel tutorial at the moment, but I'm currently working on a full Slim tutorial series of videos, which I hope to have ready soon!
@@dave-hollingworth Waiting for you to finish .. and thanks for all your excellent materials
Thank You 👍
HI, the simplest and best explanation. Thanks.
Now is missing a video about php as template system like plates, how organize using section / blocks or template Inheritance and base layouts.
Please update your PHP unit course, which i already bought, to v10.
And if possible, do first a video (overview) about Pest lib for testing and later on a full course on udemy. Thanks.
another great explanation 🎉
👍
Thank you Dave. That was magnificent. I wish that your words during your presentation are captured as comments for each line.
May I ask? The way you structured your psr-4 autoload setting: "": "sec/", will it still work if your Classes had namespaces?
Yes, if your class files are in folders that match the namespaces, autoloading will still work
@@dave-hollingworth sire 🙏 I'm having issues on php undefined array key in php _post when I want to submit a form please help me I have tried isset($_POST['userName']); also use myqli_real_escape_string but still showing undefined Array key on line......... When I submit a form
@@hongpairCheck your form is using the POST method when you submit it (method="post")
@@dave-hollingworth yes I'm using $_POST()
merci!
Amazing!!
hi @dave may i know what Text editor you are using ??
Visual Studio Code, but with most of the helpers disabled so they're not a distraction when teaching!
Hello Dave,
I am still getting the Error: Uncaught ReflectionException: Class "string" does not exist.
But then I realizing that my DAO class has a parameter with type PDO instead of the Database object, after I change the parameter type to database class object, it worked.
But in cases like this where we just need to pass a method (returns the connection object) in the constructor is there a way to handle this with DI container? or is that even a good practice?
I'm afraid I'm not sure what you mean, please could you give a code example?
Hi, I wanted to ask a question, how do I resolve classes through DI that need runtime parameters?
For example, if I have a UserService that in it's constructor will accept a User Model (say a User in Laravel), how do I inject this UserService as a dependency?
I was thinking maybe I can have a setter injection instead of a constructor so that wherever I inject the class as a dependency itself, I call it's setter method to set the User for that UserService and then go through the logic I need to go through, is this a smart idea?
Absolutely, you can define services that need parameters , and inject them using the constructor or a setter method, it's up to you .
@@dave-hollingworth In the case where the parameters are runtime only, would you say it's better to use a setter injection (userService.setUser($user)) instead of creating a new userService and then passing the $user in its constructor? (new UserService $userService ($user))
In most cases it doesn't really make much difference, it's down to personal preference - although if you need to get a user object at runtime (e.g. as the result of an action like logging in) then it might be simpler to use setter injection.
First to comment 🎉
👍