PHP Attributes 50 Minute Tutorial

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

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

  • @salimibrohimi9813
    @salimibrohimi9813 Год назад +7

    I can't believe that the duration of this video is 50 minutes.
    I didn't pause or skip a bit of this video. 50 minutes felt like 5 minutes. You're a good educator!

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

      Thanks a lot..appreciate the kind words...hope I didn't make you late for anything!

  • @mohammadabughrara6319
    @mohammadabughrara6319 9 месяцев назад +1

    After searching for hours in multiple places for tutorials, blogs.. that explain the php attributes, you were the only one who actually explained how it works.
    Thanks.

    • @GaryClarkeTech
      @GaryClarkeTech  9 месяцев назад +1

      You're welcome. Glad I could help!

    • @OmarAli-gm5lx
      @OmarAli-gm5lx 8 месяцев назад +1

      Full explanation is in the PHP docs also..

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

    You are a legend for any Wordpress/PHP developer. Thank you so much :D

  • @CodefyPHP
    @CodefyPHP Год назад +2

    Thanks, Gary for taking the time to explain attributes. This tutorial is simple to follow for all levels of PHP developers.

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

    One of the best PHP tutorials I have seen so far. Very well explained!

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

      Thanks for watching...I appreciate the kind words!

  • @andreiramboiu5184
    @andreiramboiu5184 11 месяцев назад

    Hi Gary,
    I just wanted to express my appreciation for your tutorials. Your explanations are clear and easy to follow, which has greatly helped me. Keep up the fantastic work!

    • @GaryClarkeTech
      @GaryClarkeTech  11 месяцев назад

      Cheers Andrei..I appreciate the kind words. Keep going 🦾

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

    Underrated channel - Thanks Gary for the great content you provide.

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

    Kinda late to the party but for any junior developers watching this video DO NOT ever let the ValidationRuleInterface create its own validator as it makes it nearly impossible to inject any dependencies to the validator class and breaks the single responsibility principle. The attribute should at most define any required arguments for the validator (for string length validation the min and max length for example) and the error message. Let the validator or validator locator / chain pair the attribute with its correlating validator.
    Overall great example of how to use attributes.

  • @AKcomedyshorts1507
    @AKcomedyshorts1507 7 месяцев назад

    This very specific and visibly clear way of explaining attributes and how thing works in oop way. really appreciate this work. 👏 👏 👏 For garry

    • @GaryClarkeTech
      @GaryClarkeTech  7 месяцев назад +1

      Thanks a lot...appreciate the kind words

  • @davidmutua6971
    @davidmutua6971 7 месяцев назад

    You Sound like Simon Allardice from Pluralsight. This is exactly what I wanted to learn. Also I was following the PHP docs. Today have learned how to read them properly too. By clicking the returned type then reach for it's properties. Thanks Clarke

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

    Wow, great tutorial. Thanks for sharing this amazing video

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

    Great video. Just wanted to point out though that 'use' does not actually import anything. It just tells PHP what fully qualified name to locate if that class is called (and now functions). Minor point, but ppl get this confused so much. 🙂

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

    Another great video from you. Thanks for this video though i'm gonna watch it later. I'm very grateful from your php oop course video (i watched your 2 & 3 hour videos), now i understand the oop concept completely.

  • @ЕвгенийБатулин-г9з

    Garry! Thank you! It is cool!

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

    Thanks for your work, you are my guru in PHP

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

    Hey Gary!
    I really liked this video! Is the continuation in the paid course?

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

      Thanks for watching. Yes..the paid course includes the continuation. I'm adding new stuff to the full courses all the time.

  • @GuidoAlvarez-fm9hg
    @GuidoAlvarez-fm9hg 5 месяцев назад

    At 32:52 - When INSTANCE_OF return value 2 does it mean the validation is true?

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

    That was super neat!

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

    Well done, mate! Impressive stuff you provide here!

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

    Very useful - Thank you

  • @a.karamat2168
    @a.karamat2168 10 месяцев назад

    Great & Great ❤❤ just I was thinking if it could be more straight forward by just having a validate method inside the Rule class itself instead of getValidator() and then call another class to do the validation. I mean the rule should define the validation logic itself and other wise it might not be actually a Required Rule !?

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

      Thanks...no keep the logic separate. Define and validate the rule separately. Attributes shouldn't contain a lot of logic.

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

    I have always wondered how the Attributes get validated in Symfony, and was a such black box to me. Thanks

  • @theman7050
    @theman7050 11 месяцев назад

    Im having trouble finding your video where you creared the ReflectionClass. Could you please help me finding that video?

    • @GaryClarkeTech
      @GaryClarkeTech  11 месяцев назад +1

      ReflectionClass is built into PHP. You don't need to create it.

    • @theman7050
      @theman7050 11 месяцев назад

      ​​@@GaryClarkeTechohhhhh thank you so much. And have you explained it in a video?

    • @GaryClarkeTech
      @GaryClarkeTech  11 месяцев назад

      Not on RUclips I don't think but I teach it in the full OOP course
      www.garyclarke.tech/p/learn-object-oriented-php

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

    Wow great! Just what I wanted.

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

    Why you don't use mixed for type hints?

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

      I don't see the point of mixed as a type hint tbh...seems quite meaningless

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

      @@GaryClarkeTech in my opinion to do it, it's better because you can find all points with mixed declaration for later refactor and to pass PhpStan check.

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

    Please how can we use Attributes to protect say, database credentials used to define a PDO connection. Exceptions thrown even within a try/catch, would reveal sensitive information!

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

      Use the SensitiveParameter attribute:
      www.php.net/manual/en/class.sensitiveparameter.php

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

      @@GaryClarkeTech
      Maybe, Gary, you can illustrate how. Because, I followed the link you gave us.
      It seems that the Sensitive Parameter Attribute is to be used in the function/method definition NOT when Calling the function/method.
      Should I extend the PDO Class and override the Constructor's handling of the Password, etc?

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

      No..I wouldn't extend PDO, create your own Connection class which has PDO as a dependency. Then you can mark params on that class as sensitive and throw your own custom exceptions from that class if / when PDO exceptions are thrown and caught.

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

      @@GaryClarkeTech
      Thanks Gary.
      I will give it a whirl.
      Struggling mentally to figure out how this will work.

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

      The way I figure stuff like this out is to start simple. So just create simple class with one method and a couple of parameters and add the SensitiveParameter attribute to it to get a feel for it. Then take what you know and apply it to your own code.
      Here's a very simple Connection class which I created for the Test Driven PHP course:
      github.com/GaryClarke/pest-tdd/blob/main/src/Database/Connection.php

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

    wait, php people used to parse comments in production? are they crazy, or just trolls?

  • @Dev-sf3pz
    @Dev-sf3pz Год назад +2

    Does anyone else have trouble keeping track mentally of all the different ways to make and control classes? Seems almost impossible.

    • @GaryClarkeTech
      @GaryClarkeTech  Год назад +2

      That's normal when you are starting out...everyone experiences the same thing. It gets easier, trust me!