Dependency Injection Container With & Without Reflection API Autowiring - Full PHP 8 Tutorial

  Рет қаралды 35,003

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 191
@pauldiez2696
@pauldiez2696 Жыл бұрын
Dude, your ability to simply breakdown each step, articulate and visually demonstrate, especially over a topic that can seem complex at the beginning, is amazing. Having knowledge and experience is one thing, but having the ability to explain it, like you just did, is a gift. Well done, good sir.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you so much, this means a lot to me. I appreciate it 💙
@mwaas
@mwaas Жыл бұрын
what a great explanation. no one ever explain DI smooth like that. honestly you should be the main reference to who wants to dive deep in programing in right way
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you, appreciate it 🙌
@wesammohammed1819
@wesammohammed1819 Күн бұрын
My great teacher, thank you for your great lessons English is not my language, but I am good at it. The important thing is that the simplicity and smoothness of your explanations help you a lot to understand Your student from under the war, Gaza Strip, Palestine
@PedramTeymoori
@PedramTeymoori Ай бұрын
This explanation of DI is the best I've ever seen in a tutorial. You've done an impressive job!
@ProgramWithGio
@ProgramWithGio 26 күн бұрын
Thank you 💙
@JRCSalter
@JRCSalter Жыл бұрын
So for the past week or so I have been trying to wrap my head around this concept. I have searched and read many articles about it, asked on a forum and received many replies, but nobody has explained it as well as this video. It has pretty much answered all the questions I have on the subject.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's awesome, really happy to hear this 💙
@morteza55510
@morteza55510 Жыл бұрын
Was a hard lesson but I finally understood DI Containers, thanks Gio
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yay that's awesome 🙌
@IvanStipic_Stiiv
@IvanStipic_Stiiv 2 жыл бұрын
Wow, I wish I had high quality tutorials like these back in a day. Great job!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@joshuasabac2389
@joshuasabac2389 Жыл бұрын
This is my 2nd week of the course and man, there's always something precious knowledge I gained from you. By far you are the only channel in youtube that I dont skip ads. Thanks a lot Gio.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you, I appreciate that 🙌
@Danny-lf4ny
@Danny-lf4ny 2 жыл бұрын
I've been struggling to get my head around DI for a while, but the way you break this down is just brilliant. Thanks for this.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Happy to hear, thank you 💙💙
@BenjaminDLarsen
@BenjaminDLarsen 2 жыл бұрын
Yo this is freaking amazing, thank you so much for doing this. Super clear, concise content.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it, thank you 🙌
@benderbg
@benderbg 3 ай бұрын
Presented, chopped, cooked, served on a platter. Masterpiece.
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
💙💙
@devnullex
@devnullex 2 жыл бұрын
Thank you. Your PHP series help me a lot
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad to hear that, thank you so much 💙💙
@koomooboo
@koomooboo Жыл бұрын
I was upgrading Symfony to v4.4 three months ago and got so confused with the DI and auto-wiring changes. I read most of their docs and still get confused. This is the best explanation ever!!! Thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad to hear it was helpful, thank you
@Armando-px8hi
@Armando-px8hi Жыл бұрын
I think Learning this lessons well I can go from trying to get into internship to get to the senior at once. This is the type of the lessons that are hard but I have not watched to any other courses as well. Well done, Top G!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yes, difficulty increases the more you progress through the course which is expected
@emekatimothyiloba699
@emekatimothyiloba699 Жыл бұрын
Nice Job Gio. From the comments, i see that people understand what you are doing. but honestly i am lost. I think i need to go back to the previous videos
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's ok, sometimes it takes a bit longer to grasp the concept. You can try watching it again or go back to previous lesson. Feel free to ask questions if something doesn't make sense
@cichy86
@cichy86 Жыл бұрын
It is the best explanation of DI Container I ever saw, Wit tutorials like Yours going further with modern frameworks like symfony is a piece of cake.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 💙💙
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
You definitely went the extra mile explaining this topic. Thanks a million!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad it was helpful
@kenjohnsiosan9707
@kenjohnsiosan9707 Жыл бұрын
Sheesh, what a straightforward explanation about DI. thanks for sharing this knowledge to the community.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad it was helpful, thank you
@bimg3158
@bimg3158 Жыл бұрын
Wow, i have been trying to undestard how DI work and how to be implemented, now i get the point. Thanks alot.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad it was helpful, thank you
@jean-francoisgelinas2172
@jean-francoisgelinas2172 2 жыл бұрын
This is by far the clearest explanation I've ever seen of how DI container works. It look like I'll have to watch the others 87 videos of yours :P
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you so much, glad you like it. Have fun :) more videos on the way 🙌
@ntdash2153
@ntdash2153 2 жыл бұрын
It was awesome. First time I encounter DI techniques and I know for sure that I will start using them extensively. And thanks again for your awesome videos... 👍
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it, thank you
@QorashyTech
@QorashyTech Жыл бұрын
Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you for your support 💙
@badrjeddab4549
@badrjeddab4549 Жыл бұрын
great work dude, now i have idea how the DI in frameworks work , and that awesome, using something and having the knowledge how it work behind scene it really great.thanks a lot
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's awesome, happy to hear 💙
@Abdess2305
@Abdess2305 2 жыл бұрын
What a great explanation!!! Good job!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you
@michielstornebrink
@michielstornebrink 2 жыл бұрын
Bedankt
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 💙💙
@guillermofernandez2247
@guillermofernandez2247 2 жыл бұрын
Excellente way of explaining how it works under the hood, the why, and not just doing some tutorial of the magic of a framework
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it, thank you 💙
@AhmedMwafi
@AhmedMwafi 3 жыл бұрын
Clear and smooth, nailed it
@DonatoBencosme
@DonatoBencosme Жыл бұрын
Thanks you! You have a really simple way of explaining things.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🙏
@saqlainmustaqdurjoy7043
@saqlainmustaqdurjoy7043 Жыл бұрын
This is exactly what I was searching for. Thank you so much brother💙
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad I could help, you're welcome 🙌
@hamidreza-mozhdeh
@hamidreza-mozhdeh Жыл бұрын
Wow, I was surprised. you teach it amazingly. I wish I could do the same as you. I'll try my best.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 🩵
@sadhakbj
@sadhakbj 3 жыл бұрын
Was waiting it from long time. Hope to see more videos sooner bro.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Yea, I wish I could upload faster. Not enough time unfortunately.
@sadhakbj
@sadhakbj 3 жыл бұрын
@@ProgramWithGio it's fine Gio. It's really great to have your contents to broaden my knowledge.
@michaelplichart3224
@michaelplichart3224 2 ай бұрын
Another excellent video, very informative. Thank you so much
@ProgramWithGio
@ProgramWithGio 2 ай бұрын
Glad it was helpful, thank you 🙌
@rodrigoum
@rodrigoum 2 жыл бұрын
Thanks, this is a really awesome tutorial.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Glad you like it, thank you
@benjaminiduwe2958
@benjaminiduwe2958 2 жыл бұрын
Thanks alot, great content on DI and reflection classes!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're very welcome 💙
@lairotuT-Tutorial
@lairotuT-Tutorial 2 ай бұрын
Really the Dependency Container part by this lesson is really great! Thank you Gio for all the precious input! As far as I understand you "this is not for productive use" means that if I would implement: - caching - aliasing - singleton support - autowiring - support for optional parameters - support for variadic parameters - support for interface (that comes in the next lesson I guess) or if I would avoid using single steps such as Singletom pattern in my code. I could use it in productive? Or would you still not recommend?
@ProgramWithGio
@ProgramWithGio Ай бұрын
yes with proper tests & such it could. I personally still wouldn't because existing community DI containers have been tested many times, most bugs & edge cases have already been thought of & fixed. So I would personally not reinvent the wheel. For learning purposes sure, for actual app I would want to sell to customers, I'd use a well tested framework
@lairotuT-Tutorial
@lairotuT-Tutorial Ай бұрын
@@ProgramWithGio Well, I understand this and I know this is the absolutely priorized way. Indeed I guess I will not reinvent the wheel but I think I will in most cases take a look into the blueprints and "adopt or adjust" the wheel to make it optimized for my purpose. I have experienced too many cases where just implementing leeds to duplication and even implementation of similar but different attitudes that I want to avoid inside my project.
@TomiBorchert
@TomiBorchert Жыл бұрын
13:00 what is that when the whole line is surrounded in parenthesis? seems like you are not assign it to a variable. the new container
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That way you dont have to assign to a variable & just call methods on it. When you instantiate a new class its just an object right? So you can either assign it to a variable & then call methods on that variable or call methods directly on it.
@saeedrasooli5931
@saeedrasooli5931 Жыл бұрын
this is obvious that you are so qualified in php, i have not ever watched a lesson like your lesson, Thank You 👋👋👌
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you, glad my videos are helpful 🙌
@azzazkhansiddiqui
@azzazkhansiddiqui 2 жыл бұрын
Loved your video, your video was the only one which thoroughly explained how to make a custom DI container. I use Laravel a lot and love it's DI container but it's implementation goes way above my head. I have a request, can you please make videos to extend the DI container topic to support shared/singlton bindings, instance bindings, aliasing and caching? It would be very interesting and fun to learn. Once again thanks for the amazing content!
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you & thanks for the suggestion. I'll keep that in mind. I would also advise to use PHP-DI, it has a lot of useful features. That is what we use later in the series.
@hajiomary4913
@hajiomary4913 3 ай бұрын
At 07:15 up to 08:46, Please help me to understand how it's possible to get instance before you set it because I think the code should start with setting dependencies and then set InvoiceService class but the way you do is still working help me on how the code execution went.
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
We are getting them inside the closure/callback, so that piece of code isnt called until the InvoiceService is needed and by that time all of those classes should've been registered already
@hajiomary4913
@hajiomary4913 3 ай бұрын
@@ProgramWithGio Thanks.
@ibrahemmohammad8332
@ibrahemmohammad8332 2 жыл бұрын
thank you for an amazing content, just one thing about this video in the container resolve function step 4 in case one of the $dependencies has constructor with builtin type for example: class SalesTaxService { public function __construct(protected float $x) { } } this will result to an exception, i don't know if it's intentional but i can think in a lot of cases where this will cause a problem ... shouldn't we handle it in different way and thanks again.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Yup its intentional, I mentioned that I think in the video that if you want to support scalar values then you need to modify the container implementation. Later in the series we use a well established container implementation PHP-DI, this lesson is just to prepare you on how container works behind the scenes in its basic form.
@kotyk-obormotyk
@kotyk-obormotyk 2 жыл бұрын
Дякую!💙💛
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome & thank you 💙💛
@Alex-3XL
@Alex-3XL Жыл бұрын
Thank you for your video course. Please advise - this lesson missing index.php, but in your example it works on localhost:8000 just by reloading the page. What is in the index.php? Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You can check it in the source code, public/index.php. In the description of the video there is a link to the source repository.
@truthteachers
@truthteachers Жыл бұрын
Bro, I going through the whole of section 3 only this time i checkout the complete documentation on the subject and also other example videos. Re-visting this video, at timestamp 5:41, throwing NotFoundException you used the term "binding". In my opinion raised a question "binding to what?". Correct me if i am wrong, what is meant here is that it should be "is not found in the container entries".
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Class can have a binding or an entry which binds it to another class or a concrete implementation. It's just a term, "not found in container entries" is also correct, up to you how you word your errors/exceptions
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio I agree with you in that its up to us what we want the message should be but sane and good quality assurance practice is to the throw user-meaningful message. That way when a developer, at some later date, who get hits by this error will know exactly where to debug from. I have a test crm system (open source) which throws all sorts of cryptic messages like this and when we report the problem they themselves dont know and all they do is keep quiet.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@truthteachers This is not cryptic though, its a legit error message and has a meaning. "Binding" has other meanings too, Laravel also uses this term a lot so not sure what the confusion is. This error message is not meant for user first of all & is meant to be logged, but the word "binding" makes perfect sense in this scenario.
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio Pls don't get me wrong. This just an intellectual discussion of different points of view. Thank you for being patient with me and taking the effort to reply.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@truthteachers No worries, that's why I said that either wording makes sense, whether it's "binding" or "entry" they both deliver the same meaning at the end, for some "entry" might be more clearer while for some "binding" might be more clearer, it's up to the developer to decide what makes more sense for their app
@guillermofernandez2247
@guillermofernandez2247 2 жыл бұрын
1:24 Why do you say to not use it production? security issues? performance?... 🤔
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Because it does not have all the necessary features & does not account for edge cases. For production you should use a well maintained community package like PHP-DI which we cover later in the series as well. This lesson is just to understand how Container works in a nutshell.
@obadaalzidi6452
@obadaalzidi6452 9 ай бұрын
Thanks for the great explanation. You've mentioned that the ContainerInterface doesn't define set method because it may have many different implementations. But why the interface doesn't provide the method anyway ? at the end it's only an abstract method and any framewrok can provide it's own implementation and any class that implements this interface has to provide an implementation to the set method or it has no meaning. So, In my opinion there is no problem adding the set definition to the interface and adding union type to the ($concrete param) or am i missing something ?
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
It's explained in the PSR documentation. Set method is up to the implementor, they don't want to enforce a specific contract on parameters or its return
@topalek
@topalek Жыл бұрын
awesome explanation, thanx a lot
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome 💙
@morteza55510
@morteza55510 Жыл бұрын
Why did we make the container property static? 6:35
@ProgramWithGio
@ProgramWithGio Жыл бұрын
So that it's one instance per app & easily accessible. It's just an example of how Container works behind the scenes, later we use a package & don't use the static, so it's just a temporary measure
@morteza55510
@morteza55510 Жыл бұрын
@@ProgramWithGio got it, thanks
@devnullex
@devnullex 2 жыл бұрын
Thank you. Great video. But what if in the constructor, apart from dependencies, we have other parameters, e.g. an array or an int ?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Then you'll have to pass them down, scalar values can't be passed down via container.
@weak5205
@weak5205 8 ай бұрын
Greate video! but can you explain how these instances can be resolved? If im not wrong your resolve method will call get() but the get() also call resolve(), can you explain this?
@ProgramWithGio
@ProgramWithGio 7 ай бұрын
Resolve uses reflection to inspect the class its trying to resolve, it only calls the get method if one of the dependencies of the class its trying to resolve is also a class that needs to be resolved, so its like a recursion traversing through the tree
@DanielTshragyan
@DanielTshragyan 11 ай бұрын
Greate explanation, thank you
@ProgramWithGio
@ProgramWithGio 11 ай бұрын
Glad it was helpful
@donjoes3750
@donjoes3750 Жыл бұрын
Maybe I am understanding it wrong but... how do you handle the base types? If I understand this tutorial right (which maybe I do not...) they will throw an exception within the container? Thank you for your explanations!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Do you mean interfaces? There is another video covering interface injection
@montser1994
@montser1994 3 жыл бұрын
Thanks a lot @Gio
@malikyo1263
@malikyo1263 7 ай бұрын
Vraiment extraordinaire
@ProgramWithGio
@ProgramWithGio 7 ай бұрын
Thank you
@invgreat5608
@invgreat5608 Жыл бұрын
You are super great ❤️
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you 💙
@MePeterNicholls
@MePeterNicholls 2 жыл бұрын
This is starting to make sense to me
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Awesome 👍
@liym-ntairaylangdji3441
@liym-ntairaylangdji3441 Жыл бұрын
Hi Sir, will wish to know the difference between ReflectionNamedType and ReflectionUnionTypes. And as of php 8.1, ReflectionIntersectionType has been added. Will wish to know the difference between them
@liym-ntairaylangdji3441
@liym-ntairaylangdji3441 Жыл бұрын
And please, how can I reach to you privately and how do I send the codes for the exercises?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
ReflectionNamedType is related to named arguments, ReflectionUnionTypes is related to union types & ReflectionIntersectionType related to intersection types :). I can be reached via Twitter (X)
@zubayer1093
@zubayer1093 3 жыл бұрын
I love your videos, they are very detailed. I have a question how many videos are going to be in this series in total?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you. I don't have the exact number since I plan on keeping this series updated with new PHP versions & changes. I would say at least 5-10 more videos for the third section before the project & then it will just be update videos
@federicobau8651
@federicobau8651 2 жыл бұрын
Fantastic video, thanks
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you 🙌
@Armando-px8hi
@Armando-px8hi Жыл бұрын
Also please let me know if I understand it correctly Gio, So the Dependency Injection is a design pattern where dependencies of a class are provided from the outside, rather than created internally. The Dependency Injection Container is a tool that automates the management of object dependencies within a software system?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yes pretty much
@2008rol
@2008rol 3 жыл бұрын
I spent almost whole day watching your videos, have gained a lot. I hope you can make some other videos Laravel and React. If you have videos on Udemy etc, I am willing to pay for your lessons... (I really want to learn deeper in Laravel and what happens in laravel behind the scene )
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you. Glad you like my videos & find then helpful. Once we finish with this series I'll be making more Laravel content. I don't have any paid content at the moment but thank you for your interest 🙌
@berkayb7053
@berkayb7053 3 жыл бұрын
@@ProgramWithGio waiting for laravel & vue or TALL stack content. much appreciated to your php series.
@julienSibille
@julienSibille 3 жыл бұрын
@@ProgramWithGio If you want to produce paid content, don't forget to make a poll on which tehcnologies are most wanted ^^. If the ones you choose are mine, i would pay too, it's fair to get remuneration for so many time of investment.
@issaissifou3579
@issaissifou3579 2 жыл бұрын
Thank you so much
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome
@expresscoding3525
@expresscoding3525 Жыл бұрын
Sir, I've to watch this specific videos multiple times to get better understanding, as I've to notice smaller things happening, like [this] captured by closure confused me for a longer time, and I've to use ChatGPT which informed. that closure captures surrounding environment, and because it's new topic for me, I've a request if you don't mind, like could you create a full-fledged DI. container things in a separate playlist again for all of us?? It would be much more helpful, because you've explained things, but about union types and other things, you skipped, as I'm the type of person who likes to go in-depth, it would be great if you add another playlist and make video on DI container only, like which we can use in production. Thank you for the course again... I'm still learning ☺😀
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks for the suggestion. Btw this course I think has pretty much everything that you would need to learn PHP including union types. I would just watch it from beginning
@ahzamlathiya6367
@ahzamlathiya6367 2 жыл бұрын
Thanks for this amazing Content. I'm stuck on one issue though, how to resolve a dependency if it is a scalar data type. Also, how to pass some value nested down if the dependency has some scalar dependencies.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Yea that's a bit tricky. You will need to modify the reflection part in the Container & add the checks to see if its a built-in (scalar) type, if it is add it to the arguments list but also check if it has the default value. Without default values it will be trickier to implement it, you will have to play around with it. If I find time I might make a follow-up video on this towards the end of the series
@Zubbee
@Zubbee 2 жыл бұрын
Wow. This was a lot tougher. I've noted again and again that you hardly use the "else if" and "else" keywords. Which I think is pretty cool. But is there any technical reason why you don't use them? Generally, I would have to go through this again (even after going through it twice) and I would have to read up on Reflection APIs and it's methods cause it's all new to me (except one time you used it to break the encapsulation even though a property was set to private). Thanks for these lessons Gio.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
It's totally normal, so don't worry about it. Yes I don't usually use else or else if unless I really need it. No technical reason, just preference.
@Zubbee
@Zubbee 2 жыл бұрын
@@ProgramWithGio oh, okay Gio. Thanks
@guillermofernandez2247
@guillermofernandez2247 2 жыл бұрын
A university professor once told me to not use else or else if to make different paths, only if statements to return some false condition or to throw exceptions. That I should have a main "happy" course until the end of the method and exits on undesired or unexpected conditions. Like a highway and its exits, it doesn't usually have branches or splits in two highways, there are always exceptions I know, but it's usually one main highway path with exits on the sides. As @@ProgramWithGio said, it is more a readable code reason than technical one.
@borisbar4148
@borisbar4148 Жыл бұрын
I’m running into the problem that I can’t use promoted properties as constructor parameters in my Controller classes anymore. It says the params are invalid. Could you tell me if that’s intended? Thanks a lot!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
What PHP version are you using? Can you paste in exact error message?
@borisbar4148
@borisbar4148 Жыл бұрын
@@ProgramWithGio Sorry for the very late response! I’m using PHP 8.1.4 on my development server and the error message says: Failed to resolve class "App\Controllers\Pages\Games\ReleasesController" because invalid param "test". The first condition $type instanceof ReflectionNamedType returns true, but the second condition !$type -> isBuiltin() returns false. As far as I can tell the array_map function that defines the $dependencies variable is built in a way that it always throws an error when the type is something other than a Class name. Or am I getting something wrong?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@borisbar4148 no worries. I would need to see the code to be able to help. You can DM me on Twitter and sende screenshots or link to GitHub repo and I can take a look
@MRbYemma
@MRbYemma 3 жыл бұрын
Wow! Thank you!
@lahoucineoldakdim7778
@lahoucineoldakdim7778 2 жыл бұрын
Great tuto ✅ What if we have for example to co configure Database class How to inject it in controller
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. You would bind implementation in container and then inject it like a regular class. We do that in one of the later videos, if you keep watching you'll get to it
@lahoucineoldakdim7778
@lahoucineoldakdim7778 2 жыл бұрын
@@ProgramWithGio I confused in case when i set a string value in container case 1 : set(DB::class, DB::class); case 2 set("version" , "1.1");
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@lahoucineoldakdim7778 what is the version for?
@lahoucineoldakdim7778
@lahoucineoldakdim7778 2 жыл бұрын
@@ProgramWithGio It is Just a setting keys for the application
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@lahoucineoldakdim7778 you don't need that in the container, that can just be a config file & environment variable. Keep watching the series and you'll get to the point where we start building app using proper DI implementation & config files
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome 💙
@bakosyy
@bakosyy Жыл бұрын
Hey Gio. Can you explain how can we use methods like ->get() for `Container $c` function parameter if we did not instantiate it first? The code is following: static::$container->set(InvoiceService::class, function (Container $c) { return new InvoiceService( $c->get(SalesTaxService::class), $c->get(PaymentGatewayService::class), $c->get(EmailService::class)); });
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hey, because the container instance is passed into the closure. Its already a proper container instance
@atakansenturk563
@atakansenturk563 2 жыл бұрын
Do you work with facade design ?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
If you mean Facade pattern that is used in Laravel then most of the time no. I prefer dependency injection
@LuisSilva-kf9iy
@LuisSilva-kf9iy 2 жыл бұрын
How and where do you get all those informations?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Documentation, source code, articles & experience
@LuisSilva-kf9iy
@LuisSilva-kf9iy 2 жыл бұрын
@@ProgramWithGio Do you You give private training?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@LuisSilva-kf9iy not at the moment
@LuisSilva-kf9iy
@LuisSilva-kf9iy 2 жыл бұрын
@@ProgramWithGio witch email can I contact you, I would like to keep in contact with you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@LuisSilva-kf9iy you can stay in touch on Twitter.
@elmarzougui
@elmarzougui 2 жыл бұрын
After that vedio i think that i can build my slim framwork 😄😄😄
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's great 👍
@faramarztayyari3734
@faramarztayyari3734 3 жыл бұрын
Hi Approximately how many parts is this tutorial supposed to be?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Hello. I don't have the exact number but there are few more topics I want cover before ending the series
@mdrakib-m1m5v
@mdrakib-m1m5v 3 жыл бұрын
What's your laptop/desktop configuration?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Not sure I understand the question. What configuration are you referring to?
@beticohernandez9536
@beticohernandez9536 3 жыл бұрын
Hi there. What project do you have in mind?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
I talked a little bit about that in the end of section 1 video. It's going to be a very simple budgeting/expense tracking app but it might change but so far that is what I think we'll be building.
@beticohernandez9536
@beticohernandez9536 3 жыл бұрын
The truth is, I don't speak English, I see your videos and I understand them.
@benjaminspinola1788
@benjaminspinola1788 11 ай бұрын
I have trouble understanding why that works: kzbin.info/www/bejne/bWm5oZpvbNeErac My question is, that the invoice service depends upon the SalesTaxService, PaymentService and EmailService, which are set LATER in the code. Why is it no resulting in an error, since the InvoiceService asks for these Service EARLIER in the code.
@ProgramWithGio
@ProgramWithGio 11 ай бұрын
Because it is not resolved until its needed, notice its inside closure. The code does not execute until its needed
@Григорё4екОзерцов
@Григорё4екОзерцов Жыл бұрын
is it magic?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yup, sort of 🙂
@dnkmvp
@dnkmvp Жыл бұрын
can u add vietnamese subtitle, please !!!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
KZbin adds subtitles automatically
@tomassylt
@tomassylt Жыл бұрын
nette framework have better di container
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Haven't used that framework so I wouldn't know. Anything specific that's better?
@kevdev123
@kevdev123 10 ай бұрын
if you are using composer, you have already lost control of your code.
@ProgramWithGio
@ProgramWithGio 10 ай бұрын
Disagree but whatever works for you 👍
@truthteachers
@truthteachers Жыл бұрын
Gio, although there was a lot in here that i needed to digest, this is fantastic. It gave me great understanding of PHP. My only worry is that if i used all these advanced stuff in my app, my other co-developers will have a hard time understanding the app 😀
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Glad to hear that, you don't have to incorporate this into your existing codebase, it's there for you to understand how DI containers work, for your codebase if you need a good working DI container use PHP-DI, we cover that later in this course
@truthteachers
@truthteachers Жыл бұрын
@@ProgramWithGio I skimmed thru PHP-DI and looking forward to that video, Will progress each step, as you advised. Tq.
@abdfadee8267
@abdfadee8267 Жыл бұрын
@ProgramWithGio
@ProgramWithGio Жыл бұрын
👋
@QorashyTech
@QorashyTech Жыл бұрын
Thanks!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thanks alot for the support 🙏💙
DI Container With Interface Support - Full PHP 8 Tutorial
12:13
Program With Gio
Рет қаралды 16 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
Quilt Challenge, No Skills, Just Luck#Funnyfamily #Partygames #Funny
00:32
Family Games Media
Рет қаралды 55 МЛН
Doctrine ORM - PHP Entities & Data Mapper Pattern - Full PHP 8 Tutorial
26:18
PHP Generators Explained - Full PHP 8 Tutorial
25:47
Program With Gio
Рет қаралды 32 М.
PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial
31:41
Program With Gio
Рет қаралды 34 М.
PHP cURL API Tutorial - Emailable API Integration - Full PHP 8 Tutorial
17:56
PHP MVC Pattern - View Parameters Exploit - Full PHP 8 Tutorial
22:17
Program With Gio
Рет қаралды 41 М.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН