PHP Namespace Tutorial - Full PHP 8 Tutorial

Поделиться
HTML-код
  • Опубликовано: 19 ноя 2024

Комментарии • 185

  • @cw1847
    @cw1847 3 года назад +46

    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

  • @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 🙌

  • @kudafoolhu
    @kudafoolhu 3 года назад +3

    by far the best PHP series

  • @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.

  • @purnimaaggarwal7656
    @purnimaaggarwal7656 Год назад +3

    Best PHP tutorial I have ever seen!!!

  • @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 ^^

  • @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!

  • @invgreat5608
    @invgreat5608 2 года назад +6

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

  • @iambasanta
    @iambasanta 3 года назад +3

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

  • @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!

  • @dancingdev1088
    @dancingdev1088 2 года назад +6

    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!

  • @deniskonvisar6079
    @deniskonvisar6079 Год назад +5

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

  • @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 🙏💙

  • @prajwalsiwakoti9866
    @prajwalsiwakoti9866 9 дней назад

    Gio, please promise to make this playlist always free. Thank you so much!🥺

    • @ProgramWithGio
      @ProgramWithGio  8 дней назад +1

      I have no plans on making this playlist private

  • @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 :)

  • @oussamavive1
    @oussamavive1 3 года назад +3

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

  • @dailyprodmusic9656
    @dailyprodmusic9656 3 года назад +3

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

  • @lairotuT-Tutorial
    @lairotuT-Tutorial 2 месяца назад

    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  2 месяца назад

      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 2 месяца назад

      @@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.

  • @Nneoh1
    @Nneoh1 3 года назад +3

    Very easy to follow, thank you!

  • @toy_woody
    @toy_woody 2 года назад +1

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

  • @techatival
    @techatival 3 года назад +3

    The best PHP tuts!

  • @lakhalifilakhalifi3670
    @lakhalifilakhalifi3670 2 года назад +1

    Thank you. Very good explanation !

  • @Vitalii-m6r
    @Vitalii-m6r Год назад

    Namespaces are great. Thanks for the video!

  • @boukhalfaKhaledIslam
    @boukhalfaKhaledIslam Год назад

    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  Год назад +2

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

  • @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 :)

  • @ינוןאלבז-כ1ז
    @ינוןאלבז-כ1ז 2 года назад

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

  • @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

  • @federicobau8651
    @federicobau8651 2 года назад +1

    best php course

  • @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.

  • @CarlosOrtiz-sz2pp
    @CarlosOrtiz-sz2pp 2 года назад +1

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

  • @FranciscoJunior29
    @FranciscoJunior29 2 года назад +1

    Thanks for share with us!

  • @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.

  • @oleksandrdiatchenko1192
    @oleksandrdiatchenko1192 2 года назад

    Perfect explanation! Thanks

  • @jeevachaithanyansivanandan
    @jeevachaithanyansivanandan 3 года назад +1

    Thanks for explaining this.

  • @smilemakerb
    @smilemakerb 3 месяца назад

    Great explanation!!

  • @evilservo
    @evilservo Год назад

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

  • @Zubbee
    @Zubbee 2 года назад

    Thanks a lot Gio. I follow

  • @levani7851
    @levani7851 3 года назад +3

    first! amazing as always!

  • @benderbg
    @benderbg 3 месяца назад

    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  3 месяца назад

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

  • @khaledrayan2664
    @khaledrayan2664 Месяц назад

    Best of the Best 🥰

  • @dev_troy8903
    @dev_troy8903 9 месяцев назад

    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  9 месяцев назад +1

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

  • @emekatimothyiloba699
    @emekatimothyiloba699 Год назад +1

    Great

  • @prashantgupta1940
    @prashantgupta1940 9 месяцев назад

    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  9 месяцев назад

      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 9 месяцев назад

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

  • @ehsantavakoli2418
    @ehsantavakoli2418 2 года назад +1

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

    • @ProgramWithGio
      @ProgramWithGio  2 года назад

      You're welcome, thank you for the suggestion

  • @AlirezaSalehi-xz3ch
    @AlirezaSalehi-xz3ch 3 года назад +1

    thank you

  • @Netpilation
    @Netpilation 6 месяцев назад

    i could not help but like

  • @alidakhil3554
    @alidakhil3554 2 года назад

    Super excellent!!

  • @tolebiGamingTime
    @tolebiGamingTime 2 месяца назад

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

    • @ProgramWithGio
      @ProgramWithGio  2 месяца назад +1

      Maybe in future

    • @tolebiGamingTime
      @tolebiGamingTime 2 месяца назад

      @@ProgramWithGio
      I'm impatiently waiting and everyone is also waiting for you, thank you for everything you do

  • @rickythegermanshepherd5438
    @rickythegermanshepherd5438 Год назад

    Thank you 🙏

  • @kenjohnsiosan9707
    @kenjohnsiosan9707 2 года назад

    Thank you sir

  • @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 🙌

  • @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

  • @memack101
    @memack101 2 года назад

    Thank you.

  • @mohammad9649
    @mohammad9649 Год назад

    JUST GREAT ...

  • @udayan285
    @udayan285 Год назад

    Thanks

  • @alphayowakarindi
    @alphayowakarindi 2 года назад

    Thank you!

  • @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 👍

  • @hajiomary4913
    @hajiomary4913 10 месяцев назад

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

    • @ProgramWithGio
      @ProgramWithGio  10 месяцев назад +1

      There are 2 objects, 2 different instances

  • @awaiskhan-bd7cr
    @awaiskhan-bd7cr 5 месяцев назад

    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  4 месяца назад +1

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

  • @julienSibille
    @julienSibille 3 года назад

    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  3 года назад

      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 2 года назад

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

    • @ProgramWithGio
      @ProgramWithGio  2 года назад +2

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

  • @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.

  • @juliocheranthonypenaperez7919
    @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

  • @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

  • @mark-dev-1
    @mark-dev-1 3 месяца назад

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

    • @ProgramWithGio
      @ProgramWithGio  3 месяца назад

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

  • @n_o_x2343
    @n_o_x2343 2 года назад

    whats your IDE?

  • @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

  • @das_evoli
    @das_evoli 2 года назад

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

    • @ProgramWithGio
      @ProgramWithGio  2 года назад

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

    • @das_evoli
      @das_evoli 2 года назад

      @@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  2 года назад +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.

  • @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.❤

  • @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 RUclips by setting the playback speed. Is there anything specific that is confusing?

  • @unik_production
    @unik_production Год назад

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

    • @ProgramWithGio
      @ProgramWithGio  Год назад

      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 RUclips has a feature to let you slow it down to your liking

  • @Rahul-ur6xz
    @Rahul-ur6xz 2 года назад

    Why Do You Speak So Fast ? I Hate That

    • @ProgramWithGio
      @ProgramWithGio  2 года назад +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 RUclips, click the ⚙️ icon and set playback speed to 0.5x 👍

    • @Rahul-ur6xz
      @Rahul-ur6xz 2 года назад

      @@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 11 месяцев назад

      ​@@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 Год назад

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

    • @ProgramWithGio
      @ProgramWithGio  Год назад

      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 RUclips 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 Год назад

      @@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  Год назад +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__ Год назад

    thank you