PHP Namespace Tutorial - Full PHP 8 Tutorial

Поділитися
Вставка
  • Опубліковано 18 вер 2024

КОМЕНТАРІ • 181

  • @cw1847
    @cw1847 3 роки тому +45

    This just blew every lesson I've gone through on namespaces out of the water. Thanks for such a clear and thorough explanation.

    • @fiho-ohif
      @fiho-ohif 2 роки тому +2

      I totally agree, within minute one I understood why I came here. Due to that I stayed for the rest of the content and have started looking through more of the series.

  • @ulijibkadelm318
    @ulijibkadelm318 Рік тому +18

    What the hell, no freakin way this tutorial is free. I've been following from the start and it just blew my mind how every topic covered in detail and not create an understanding hole like another tutorial video. DEF gonna check and be your patreon. Thank you sm Gio!

  • @channel-gi3nd
    @channel-gi3nd 3 роки тому +8

    I wish this course goes viral and gets you millions of views

  • @JohnnyBigodes
    @JohnnyBigodes 3 роки тому +7

    Showing errors/fails is completely valid. That way your viewers see why the error occured and will know how to fix it.

    • @ProgramWithGio
      @ProgramWithGio  3 роки тому +4

      I agree, that's why I show errors when I can. It's part of the learning process.

  • @quantumastrologer5599
    @quantumastrologer5599 Рік тому +6

    This is tutorial series is indeed a goldmine. Your subscriber count doesn't reflect the quality of this at all. Wish you all the best and thanks a lot!

  • @selcukdemirbas2514
    @selcukdemirbas2514 3 роки тому +27

    You have very "smooth" tutorials and definitely deserve much more attention. Cheers.

    • @ProgramWithGio
      @ProgramWithGio  3 роки тому +2

      Glad you like them! Thank you & cheers 🙌

  • @bracoyote96
    @bracoyote96 Рік тому +3

    I just LOVE how he explains things. He uses the perfect words to explain each feature and the perfect examples for me to fully get it. When it comes to programming, people's brains work in different ways and the same explanation may not work for everyone. I love how this guys' brain works. It's just what I need ^^

  • @kudafoolhu
    @kudafoolhu 2 роки тому +3

    by far the best PHP series

  • @iambasanta
    @iambasanta 2 роки тому +3

    holly molly. crystal clear explanation. Thank you man ! You are a great teacher !!! Love from NEPAL

  • @purnimaaggarwal7656
    @purnimaaggarwal7656 Рік тому +3

    Best PHP tutorial I have ever seen!!!

  • @invgreat5608
    @invgreat5608 2 роки тому +5

    Wow.... So clear, brief and simply put... THANK YOU!

  • @deniskonvisar6079
    @deniskonvisar6079 Рік тому +5

    Very detailed and structured info in every lesson, thank you so much for your knowledge sharing!

  • @dancingdev1088
    @dancingdev1088 2 роки тому +5

    So awesome content. I'm right now brushing up my skills after working 8 years in the industry and this is so helpful

  • @basilistigris640
    @basilistigris640 Рік тому

    By far the best programming course I've seen so far., and i have wacth a lot to learn the best practise, thank you very much!

  • @Armando-px8hi
    @Armando-px8hi Рік тому +1

    I do not even know how but I understood every single word you said in this video(my language is not english).Thank you for this explanation,everyone needs your explanation about namespaces.Never knew about aliasing such a good thing.THANK YOU GIO!

  • @8bitersxxx
    @8bitersxxx 2 роки тому +6

    Wow, it's so clear and easy to understand. Thanks for making this video, hope you get to 10K and 100K soon

  • @digitalgenre7194
    @digitalgenre7194 2 роки тому +2

    WOW. This is almost Linked in quality tutorial. very well explained. thank you. the only difference is the you speak a bit to fast when compared to professionals instructors. Other than that, you are up there with then. Great job.

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      Thank you. I am trying to improve on the speed, recent videos should be better :)

  • @techatival
    @techatival 3 роки тому +3

    The best PHP tuts!

  • @lairotuT-Tutorial
    @lairotuT-Tutorial 6 днів тому

    Great explanation for namespaces!
    In addition to conflicts with namespaces you also mention the readability part of it. I often think about a general point where people discuss that its a pitty that PHP does not allow to extend a class to more than one class. Where most solutions come to interfaces and traits I usually found the core that it usually you need two separated classes as although you commonly talk about the "same" object you indeed think about two different objects.
    Let me give you an example of apps for vetenarians:
    It could make sense to have classes like Animals, Mammals extends to Animals, Dogs extends to Mammals, Labrador extends Dogs....
    On the other hand classes like Customers, Patients extend Customers, Selfpayers extends Patients could be needed as well.
    On the other hand the Dogs are the Patients as well. I often don't go with Interfaces or Traits as the business case is mostly devided if I think about the dog as an animal OR as a patient. In the cases where both worlds might be needed I would instead create extra classes like DogPatients extends to Patients that makes use of public functions of the Dogs class as well and as maybe CatPatients that makes use of another Cats class. If however the primary point of view changes I have again extra classes like PatientDogs extends Dogs that only make use of public functions of Patients class.
    In these cases I guess using the alias DogPatients for the Patient class and the other way around would result in the usage of PatientDogs and DogPatients which shows that it indeed is the same object related to two classes. Do you agree or do you think that creates more confusion instead?

    • @ProgramWithGio
      @ProgramWithGio  6 днів тому

      Yea that could be a way to solve such issues. I personally would make Patient an interface so that way anyone can be a patient

    • @lairotuT-Tutorial
      @lairotuT-Tutorial 5 днів тому

      @@ProgramWithGio I see. Maybe I have to break through a wall in my thinking there. I guess a combination of Traits and Interfaces might be the better standard to use.

  • @dailyprodmusic9656
    @dailyprodmusic9656 3 роки тому +3

    Wow very easy way to explain those concepts
    keep going bro 👍💓

  • @Nneoh1
    @Nneoh1 2 роки тому +3

    Very easy to follow, thank you!

  • @omaryahia
    @omaryahia Рік тому +1

    I really really really
    while(true) echo "really!"
    like your playlist. it is a gold mine! each video is like a piece of art
    I can safely say I have never thanked a youtuber that much and comment that many times on his videos
    you are really phenomenal with the insane insane high quality content you provide
    these are really well put and really well planned videos
    🌷✨🌷✨🌷✨🌷
    thank you gio
    I want to go all around telling my dev friends about your videos

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +1

      Thank you, this means a lot & makes me super happy 🙏💙

  • @oussamavive1
    @oussamavive1 2 роки тому +3

    that's gold right there !!! thank you so much for these lessons man, it's huge!

  • @lakhalifilakhalifi3670
    @lakhalifilakhalifi3670 2 роки тому +1

    Thank you. Very good explanation !

  • @toy_woody
    @toy_woody 2 роки тому +1

    You are so good 😊 I will became PHP god because of you :D Thank you so much

  • @federicobau8651
    @federicobau8651 2 роки тому +1

    best php course

  • @Vitalii-m6r
    @Vitalii-m6r Рік тому

    Namespaces are great. Thanks for the video!

  • @boukhalfaKhaledIslam
    @boukhalfaKhaledIslam 10 місяців тому

    You could use simple examples like animals or food in your next tutorials, as I am an Arabic person who does not know anything about paddle and stripe vendors, so I went to google and looked up these terms so I could follow along.
    Thanks a lot for the best PHP tutorial ever

    • @ProgramWithGio
      @ProgramWithGio  10 місяців тому +2

      Stripe and paddle are like payment gateways, it's real life examples. Using animals or food wouldn't make sense in this context

  • @jesiooooo
    @jesiooooo 3 роки тому +1

    Greate video. Hello from Poland :)

  • @okpujeremiah6989
    @okpujeremiah6989 Рік тому

    Thank you very much for this video. This was what i have been searching for.

  • @keremardicli4013
    @keremardicli4013 Рік тому

    What a wonderful and outstanding lesson... Top notch

  • @CarlosOrtiz-sz2pp
    @CarlosOrtiz-sz2pp 2 роки тому +1

    Very good class, thank you!!!!!!

  • @levani7851
    @levani7851 3 роки тому +3

    first! amazing as always!

  • @AlirezaSalehi-xz3ch
    @AlirezaSalehi-xz3ch 2 роки тому +1

    thank you

  • @user-mo3cw6go7c
    @user-mo3cw6go7c Рік тому

    Stunning! Stunning! Stunning!
    Thanks! Thanks! Thanks!

  • @smilemakerb
    @smilemakerb Місяць тому

    Great explanation!!

  • @FranciscoJunior29
    @FranciscoJunior29 2 роки тому +1

    Thanks for share with us!

  • @johongirrahimov2343
    @johongirrahimov2343 3 роки тому

    Phew! 20 minutes took me 100minutes of my times to understand and complete as a PHP beginner

    • @ProgramWithGio
      @ProgramWithGio  3 роки тому

      It's ok and totally normal. I sometimes need to watch tutorial videos multiple times to understand things

    • @johongirrahimov2343
      @johongirrahimov2343 3 роки тому +1

      @@ProgramWithGio Yeah, harder it's better it's :)

  • @benderbg
    @benderbg Місяць тому

    Its not stated in the video clearly at 11:30, but to instantiate Email class after prepending it with backslash or importing it we also need to include it in the index.php file with:
    require_once '../Notification/Email.php';

    • @ProgramWithGio
      @ProgramWithGio  Місяць тому

      Thanks for pointing it out. I think I accidentally cut out the audio/video portion during editing

  • @jeevachaithanyansivanandan
    @jeevachaithanyansivanandan 3 роки тому +1

    Thanks for explaining this.

  • @tolebiGamingTime
    @tolebiGamingTime 8 годин тому

    Good lesson,
    Can you make a cool video like this about microservice architecture?

  • @ehsantavakoli2418
    @ehsantavakoli2418 Рік тому +1

    Thanks a lot for your awesome videos . Can you just create videos for design patterns too ?

  • @oleksandrdiatchenko1192
    @oleksandrdiatchenko1192 2 роки тому

    Perfect explanation! Thanks

  • @Zubbee
    @Zubbee 2 роки тому

    Thanks a lot Gio. I follow

  • @rickythegermanshepherd5438
    @rickythegermanshepherd5438 Рік тому

    Thank you 🙏

  • @evilservo
    @evilservo 11 місяців тому

    with this course I am starting to understand how Laravel is structured

  • @mimoh2000
    @mimoh2000 2 роки тому +1

    I followed the tutorial with the same file structure. Am using PHP 8.2.0 alpha with nginx 1.23.1. requiring the full class path works. But when using the namespace keyword, everything breaks with class not found.

    • @mimoh2000
      @mimoh2000 2 роки тому +1

      I found out the problem. I forgot to add the require_once at the top of the file. I really need to completely remove my Java cap and put the PHP version. Thanks.

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      Awesome, glad you figured it out

  • @3042640426
    @3042640426 Рік тому +1

    You really are my hero! Can you explain why I need to require CustomerProfile in index.php?
    I thought I just had to use the full namespace/CustomerProfile in the Transaction file and that would be enough.
    Why is it necessary to require it?
    Is it because even if I specify the full namespace when running a new CustomerProfile, the program may not load the class?
    Is that why I have to require it?
    In Laravel, when I use the keyword "use", Laravel will help me autoload, so I don't have to require it again. Is that correct?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Thank you. We are not using autoloading in this episode, next episode is where we add composer & autoloading so require will no longer be needed.

  • @Netpilation
    @Netpilation 4 місяці тому

    i could not help but like

  • @emekatimothyiloba699
    @emekatimothyiloba699 Рік тому +1

    Great

  • @memack101
    @memack101 2 роки тому

    Thank you.

  • @prashantgupta1940
    @prashantgupta1940 7 місяців тому

    Hey! I know it's a big ask for the course which is completely free with such amazing quality. But it would be great if you made a git repo of the code at the end of every video. Will be more than happy to help you if you want.

    • @ProgramWithGio
      @ProgramWithGio  7 місяців тому

      There is a repo for lessons where it makes sense. Some lessons are pure theory so not much can be put into repo. You can check descriptions of the videos and you will find the link to the repo

    • @prashantgupta1940
      @prashantgupta1940 7 місяців тому

      @@ProgramWithGio Got you. Just thought it would be easy to code along for a beginner like me.

  • @emekatimothyiloba699
    @emekatimothyiloba699 Рік тому

    Hey Gio, thanks for all you do. Please how long have you been writing PHP code and how do you learn

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +1

      13+ years. I learn by reading open source code, diving into the source of framework when I don't understand something & by watching videos/reading articles about specific topics.

  • @alphayowakarindi
    @alphayowakarindi 2 роки тому

    Thank you!

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 Рік тому

    Thank you sir

  • @alidakhil3554
    @alidakhil3554 2 роки тому

    Super excellent!!

  • @udayan285
    @udayan285 10 місяців тому

    Thanks

  • @mohammad9649
    @mohammad9649 Рік тому

    JUST GREAT ...

  • @ieduardoms
    @ieduardoms Рік тому

    Thank you very much. By the way, I think you don't need to apologize for making coding mistake, every developer makes mistakes. Have you ever worked with a developer who doesn't make mistakes?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +1

      Of course, this was more like a joke. Thank you 🙌

  • @dev_troy8903
    @dev_troy8903 7 місяців тому

    11:00 regarding the fully qualified namespace, I felt that putting a back slash before the namespace was like telling php to return to the global namespace then look for the notification namespace. Is that what it really means ??
    Also another question, after 11:00, what keyboard you are using, if you don't mind saying. 😄

    • @ProgramWithGio
      @ProgramWithGio  7 місяців тому +1

      Yea pretty much. Dont remember which keyboard I was using at that time :D

  • @hajiomary4913
    @hajiomary4913 8 місяців тому

    I see object(...)#2 but it is the first instance, for example in 16:07. So how this number 2 comes

    • @ProgramWithGio
      @ProgramWithGio  8 місяців тому +1

      There are 2 objects, 2 different instances

  • @HakanGalip
    @HakanGalip Рік тому

    When did we instantiate the explode() function ? I did not see that...
    We get problems when using autoloader and try to instantiate a class from a different Folder. How to solve this problem?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Not sure what you mean. Explode is not a class so you don't instantiate it. What problems are you seeing, can you post error message? Also without seeing your code it's hard to help you, so if you post your code in GitHub I'll be happy to take a look. You can also DM me on Twitter and send me screenshot of the problem 👍

  • @awaiskhan-bd7cr
    @awaiskhan-bd7cr 3 місяці тому

    U r a great teacher but one thing is that your speed is too fast those who barely understand will struggle a lot in this course ❤

    • @ProgramWithGio
      @ProgramWithGio  2 місяці тому +1

      Yes, you are right. This was a mistake I made in some of these videos. Gets better in third section

  • @julienSibille
    @julienSibille 2 роки тому

    When i use the bracket to import multiple classes from the same namespace, i can not use my vscode right click "import class" functionnality anymore

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      I don't use vscode so I'm not sure what the issue is. You can DM me with a screenshot & I can help troubleshoot it if you still need help

  • @imdadullah9093
    @imdadullah9093 Рік тому

    Please make a video on debugging in php there is no video available

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +2

      There is a video about debugging using xdebug in third section. Keep watching & you'll get there

  • @juliocheranthonypenaperez7919

    Why do we have to import the file but also use the use {namespace}?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Not sure I understand the question, can you clarify? You need use statement to import the file

    • @Cheranthony
      @Cheranthony Рік тому

      @@ProgramWithGio Sorry I was confused, I had to watch the video several times to understand that Namespaces are used to use classes that have the same name

  • @arduinoguru7233
    @arduinoguru7233 2 роки тому

    Can you do ActiveRecord PHP tutorial, I subscribe waiting for the tutorial very few made tutorials like you.

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      Thank you for subscribing. We will cover active record basics in the third section, we are on Data Mapper now & Doctrine.

    • @arduinoguru7233
      @arduinoguru7233 2 роки тому +1

      @@ProgramWithGio That's really great, I was doing simple basic php coding for years form my personal project, and I want to learn what's so-called "Software Engineering" your lessons will help a lot.

  • @mark-dev-1
    @mark-dev-1 Місяць тому

    1:55 didn't actually get error with constants.

    • @ProgramWithGio
      @ProgramWithGio  Місяць тому

      Are you sure its the same constant name & both files are included in the same place?

  • @pravin1074
    @pravin1074 2 роки тому

    Can you explain php inotify

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      I have not used inotify. Not sure if I will include that in this series but maybe as a stand alone video, thanks for the suggestion

  • @MobiusCoin
    @MobiusCoin Рік тому

    Why is name spacing functions not a common practice but classes are?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      What do you mean? Namespaces is very common

    • @MobiusCoin
      @MobiusCoin Рік тому

      @@ProgramWithGio You said at 5:10 that namespacing functions and constants are not common practice.

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Ah I misunderstood the question. Its just I dont se namespacing functions being used alot in codebases

  • @truthteachers
    @truthteachers 2 роки тому

    Bro, the source codes from 2.2 to 2.3 and this one are all disconnected. What i mean is you are popping up scripts from nowhere.😒 The codes in this video are not available as starter. I do not know how the others are finding it to be good but i totally lost.

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому +1

      Some videos don't have a source like this one because there is not much to include. It's mainly theory, it's not like a project. Some videos where more coding is involved the link to source is in the description. This one just shows examples. If you still need these examples ping me on Twitter and I'll write them and send them to you no problem.

    • @truthteachers
      @truthteachers 2 роки тому

      @@ProgramWithGio To follow the code, test and try i would need the code. Since it just a theory that it would have been good if you could stated where to locate the starter code at the beginning of each video. You course is very extensive and good but does is not complimented well and seems too rushing. I had to slow down the speed of the video. Anyway, its ok.

    • @ProgramWithGio
      @ProgramWithGio  2 роки тому

      @@truthteachers starter code is any of the previous codes, so if you have source from like 2.1 it's the same, you can code along with that, it's just 3 files with about 10 lines of code on each so I don't really see a problem. If anything it's better to write it on your own following the video with pauses but that's just my opinion. As I mentioned other videos where there is more coding involved there is a link to the repo. I'll see if I can commit these files for this video as well 👍. I do agree about the speed being too fast, I improved on that later on, was doing editing wrong and cutting out too many empty spots which makes it sound that I don't breath, should be better in the third section.

    • @truthteachers
      @truthteachers 2 роки тому

      @@ProgramWithGio Fantastic. Thank you.❤

  • @n_o_x2343
    @n_o_x2343 2 роки тому

    whats your IDE?

  • @das_evoli
    @das_evoli Рік тому

    Not 100% sure if I like how php handles namespacing. It looks like it can get messy pretty fast

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Can you elaborate? I think namespaces are actually done pretty well

    • @das_evoli
      @das_evoli Рік тому

      @@ProgramWithGio I think what throws me off is that I don't understand why we can't just use an alias on the require statements and use that alias to refer to the correct class

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +1

      @@das_evoli keep watching, we get to composer & autoloading that will make it make more sense why namespaces are good & better than include/require because namespaces work really well with autoloading.

  • @watchernode6138
    @watchernode6138 Рік тому

    18:00 Why do you call them Square brackets, when you are using curly brackets ?
    use PaymentGateway\Paddle\{Transaction, CustomerProfile}; // {}

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      You're right, I misspoke. Sometimes I get carried away 😁

  • @fakhriddinabduraimov3323
    @fakhriddinabduraimov3323 Рік тому

    What happened? till this video everything was understandable. Here Everything very fast, codes changing fast, speaking very fast ((

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      You can slow it down on UA-cam by setting the playback speed. Is there anything specific that is confusing?

  • @unik_production
    @unik_production 11 місяців тому

    why are you rushing while teaching keep it simple and slow down your speed

    • @ProgramWithGio
      @ProgramWithGio  11 місяців тому

      I just talk fast in general but during early on in this course I made editing mistakes where I cut out empty spaces so it make it seem like I don't breathe. Should get better later on. That being said, thankfully UA-cam has a feature to let you slow it down to your liking

  • @Rahul-ur6xz
    @Rahul-ur6xz Рік тому

    Why Do You Speak So Fast ? I Hate That

    • @ProgramWithGio
      @ProgramWithGio  Рік тому +1

      I improved on that in later videos. I've made a mistake where I cut out almost all empty spaces in videos during editing which make it sound like I don't breathe. You can thankfully slow it down on UA-cam, click the ⚙️ icon and set playback speed to 0.5x 👍

    • @Rahul-ur6xz
      @Rahul-ur6xz Рік тому

      @@ProgramWithGio ok

  • @truthteachers
    @truthteachers Рік тому +1

    Bro, at timestamp 13:29 why does the var_dump explode prints 'foo" without the $this in var_dump(explode(',',"hello,world'))? In my case it is still run the built-in explode function and not the class function. I get the date and time printed instead of 'foo'. I am using PHP 8.1.

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      Because it is running the explode function that is defined in the same file that contains the class, can't use $this because function is not within the class, if you notice it is outside of the class. Show me your code & I may be able to help further since without seeing the code I can't really know why you are getting different result.

  • @truthteachers
    @truthteachers Рік тому

    Bro, the DateTime Class still loads even though its not in the same namespace. PHP will look for a class within the namespace and if not found it will look for it the global space. Is this correct?

    • @ProgramWithGio
      @ProgramWithGio  Рік тому

      I think I answered your other question which may help answer this as well. In short, yes, if you define function in the same file then it will use that function, otherwise it will look for the function in global space.

    • @xescoalarconmoral4904
      @xescoalarconmoral4904 9 місяців тому

      ​@@ProgramWithGio Hi! I'm using vscode and I think @truthteacher is also using it. Vscode "automagically" writes a line with: use DateTime; I think in this case this IDE is "too smart". I'm talking about 09':25'' but I think is the same problem. Gio you are brilliant and this is the best course I have ever taken ❤

  • @webdevtutorials6579
    @webdevtutorials6579 10 місяців тому

    use './../..'; didn't work for me
    namespace './../..'; worked

    • @ProgramWithGio
      @ProgramWithGio  10 місяців тому

      Can be because of how it's setup on your end. Also I saw your reply on other comment in email but don't see it here. Maybe UA-cam removed it, sometimes it does that. To address that part, I explained how to instantiate objects in the beginning of the section so I'm not sure what you mean. If you follow the course from start to end you should be fine. If you are just picking & watching random videos then yea u might feel like something was missed. Either way the course may not be for everyone, plenty of other courses & content out there. Best of luck 👍

    • @webdevtutorials6579
      @webdevtutorials6579 10 місяців тому

      @@ProgramWithGio you explained how to instantiate objects but you didn't explain that in a class we can define a variable/attribute/field of type object as an instance of another class, an example from previous video :
      class Transaction {
      public ?Customer customer = null;
      }
      please just take this as feedback and nothing else

    • @ProgramWithGio
      @ProgramWithGio  10 місяців тому +1

      @@webdevtutorials6579 but that's just a property, I covered properties and property can have any scalar type or object type. The restriction as far types goes is callable & I mentioned that as well I think. Maybe I should've made it clearer, thanks for the feedback.

  • @ilya_123__
    @ilya_123__ 11 місяців тому

    thank you