Refactor cURL to Guzzle With Retry Logic - Multiple API Integrations - Full PHP 8 Tutorial

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ต.ค. 2024
  • We refactor the code from the last lesson to use Guzzle in this lesson. We also integrate with a second API using interfaces.
    SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
    👍 Smash the like button
    🤝 Subscribe to the channel & turn the notifications on
    💬 Post comments, any feedback is greatly appreciated
    ⭐ Become a Patreon: / programwithgio
    THANK YOU!
    🛠️ TOOLS & SERVICES I USE
    Digital Ocean Hosting - Get 100$ credit - m.do.co/c/38b9...
    Domains on Namecheap - namecheap.pxf....
    Envato Elements - 1.envato.marke...
    LESSON 3.22
    Course Outline - github.com/gge...
    Course Playlist - • Learn PHP The Right Wa...
    RESOURCES
    Source Repo - github.com/gge...
    Guzzle - docs.guzzlephp...
    ** Affiliate Disclaimer: Some of the above links may be affiliate links, which may generate me a sales commission at no additional cost to you.

ความคิดเห็น • 54

  • @dotsad
    @dotsad 2 ปีที่แล้ว +32

    11 months ago I wrote my first line of code, it was python, I used python to learn the basics and get on road. I studied front end for 5-6 months, mostly React, every day, the entire fking day, I was enjoying it, but getting a job was so hard (Yes, now I know 6 months is nothing), it felt like everyone was filling the vacancies for React instantly. So I got frustrated and took a break for ~40 days. when I came back I was sick of the front end, I started learning Node (Yes, once again I was entering the same hole) and quickly discarded it. So I started thinking about programming something a notch below popularity, I noticed here in my country a lot of people still uses php, which i thought was trash bc not many people make content for php compared to the holy grail fullstack JS. But oh boy I was wrong, actually that is the reason why php is so perfect, it is underrated, "nobody" wants to learn, you have more opportunities. I started learning php 3-4 months ago bc i found this series, I learned Laravel in parallel at some point and now im working as a freelancer, yesterday I finished my first Web App for a company and now i have like dozen Apps to come bc they loved it. PHP rocks! Thank you Gio for your hard work man, I love you.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +5

      This has made my day, that is awesome & proud of you. Thank you so much 💙

    • @veltive3268
      @veltive3268 2 ปีที่แล้ว +3

      In the US Node might be taking over PHP, but pretty much the rest of the world still prefers PHP, around 70%.

    • @Zubbee
      @Zubbee 2 ปีที่แล้ว +1

      Wow, this great! Gio's lessons have been absolutely amazing. Thanks again and again Gio

    • @bijianwu5124
      @bijianwu5124 ปีที่แล้ว +1

      very inspiring! keep it up!

    • @DigitaSkills101
      @DigitaSkills101 ปีที่แล้ว +1

      Are you programming in vanilla Php?

  • @Vitalii-m6r
    @Vitalii-m6r ปีที่แล้ว +2

    This is by far the best tutorial for PHP learners! Thanks!

  • @yuriymiroshnychenko5446
    @yuriymiroshnychenko5446 2 ปีที่แล้ว +1

    Great video as always! I've been using Guzzle for a long time and didn't know about the retry method. Thank you!

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      I know right? I did not know this as well myself.

  • @Zubbee
    @Zubbee 2 ปีที่แล้ว

    This was very cool. Again seeing how refactoring makes things scalable, expandable and more is amazing. I've been forging ahead with the hope that I'll return to these lessons when I encounter these things. I'm like a sponge for now, just taking... Lord help me. Thanks Gio!

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      That's awesome, thank you 💙

  • @yongdev
    @yongdev 2 ปีที่แล้ว +1

    Never heard about this. Thanks for bringing it to my notice ❣️❣️🤗

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      You're welcome, thank you 🙌

  • @shaikhalamin23
    @shaikhalamin23 2 ปีที่แล้ว +1

    Really awesome video. Waiting for your DTO video.

  • @cpanagoulias
    @cpanagoulias 2 ปีที่แล้ว

    I see a new video from Gio, I smash the like button!

  • @mwaas
    @mwaas ปีที่แล้ว

    king of deep explanation

  • @devhenry9054
    @devhenry9054 2 ปีที่แล้ว +2

    Awesome knowledge, thanks
    If possible after finishing this course.. please make a full project like ecommerce or blog ... That's way we understand all of the knowledge that you share and how to implement in real life project.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Thanks for the suggestion 💙

    • @nerminsistek9006
      @nerminsistek9006 2 ปีที่แล้ว +1

      I totally agree with you. Those are really abstract and advanced concepts, and the best way to absorb all this stuff is through some kind of a project. I swear, I would pay for that. This is the most complete and most advanced PHP course I found on the internet, and if he includes a project in it, that would be perfect.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +2

      @@nerminsistek9006 we will work on a full project at the end and deploy it

    • @devhenry9054
      @devhenry9054 2 ปีที่แล้ว +2

      @@ProgramWithGio Thanks sir for accepting suggestions. It's means a lot. You have share a such tremendous knowledge in this 3 course. After the real project our base is strong enough to create any project. We will waiting for that project. Once again thank you

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      @@devhenry9054 no problem. It was always a plan to work on a project at the end. It won't be e-commerce but it's going to be a good project that will allow us to practice most of what we learned in the series

  • @memack101
    @memack101 2 ปีที่แล้ว

    Pure gold. Thank you.

  • @ЯоКуассиЖан-Клод
    @ЯоКуассиЖан-Клод 10 หลายเดือนก่อน

    Thanks you very very much may god bless you, bro!)

  • @DevAmirull
    @DevAmirull ปีที่แล้ว

    Thank you ❤

  • @danielpaszek9071
    @danielpaszek9071 2 ปีที่แล้ว

    Great tutorial series :)

  • @memack101
    @memack101 2 ปีที่แล้ว

    Thank you.

  • @dhirendrasinghnegi7948
    @dhirendrasinghnegi7948 7 หลายเดือนก่อน

    Sir, there is a callable argument $handler in the retry method can you you explain from where it is fetching that argument while you didn't declared that anywhere.

    • @ProgramWithGio
      @ProgramWithGio  7 หลายเดือนก่อน

      That is provided by Guzzle PHP

  • @wildrose7291
    @wildrose7291 2 ปีที่แล้ว

    Hello,
    I'm start learning php from this series , l'm asking about how can i practice php or where can i find php exercises as i need Practical application to lessons( l'm in first lessons)
    Thx

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Hello. At the end of first & second sections there is an exercise you can work on. Aside from that you can work on some project and practice your skills that way, can even expand on the exercise project from the end of section one.

  • @Nuszja
    @Nuszja ปีที่แล้ว

    Would it be possible to instead of binding key in the DI container, make $apiKey in constructor of EmailValidationService as optional? If different key is not passed as argument, it pulls it from .env? By the way, you create amazing videos and I hope more people will consider learning PHP after seeing your channel ✌️

    • @ProgramWithGio
      @ProgramWithGio  ปีที่แล้ว +1

      Thank you 🙏. Sure, many different ways you can do this. The thing that would bother me though is having to load stuff from env from within email validation service.

  • @joemak8181
    @joemak8181 2 ปีที่แล้ว

    Can you have an overview about grpcurl

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว +1

      Haven't used that, thanks for the suggestion

  • @cpanagoulias
    @cpanagoulias 2 ปีที่แล้ว

    On line 80 in the RetryMiddleware (method onFulfilled) it should say "if (!call_user_func(
    $this->decider,
    $options['retries'],
    $req,
    $value,
    null
    )) {
    return $value;
    }"
    It took me a while to figure out what the !($this-decider) meant until I checked the Guzzle code myself and I found it like I quoted before. Unless it's a notation I m not familiar with... Gio your comments please.

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      It calls the function by doing () on it, it doesn't need call_user_func in that case. You can call functions like this $variable()

    • @cpanagoulias
      @cpanagoulias 2 ปีที่แล้ว

      @@ProgramWithGio I knew the $variable() and the call_user_func but never have I seen the ($variable) one. Just wanted to clarify this.

    • @cpanagoulias
      @cpanagoulias 2 ปีที่แล้ว

      Or the ($variable)(args) rather...

    • @ProgramWithGio
      @ProgramWithGio  2 ปีที่แล้ว

      ($variable) does not call function, it just wraps it around, ! $this->decider() would not evaluate properly, therefore it wraps the variable in parenthesis ($this->decider)() and applies the ! to it. Its basically to make sure that the ! part is applied to the result of the function call instead of it being applied to $this->decider as a property.

    • @cpanagoulias
      @cpanagoulias 2 ปีที่แล้ว

      @@ProgramWithGio Ohh I see. Didn't know that! Now it makes more sense. The call_user_func made it clear to me as soon as I read it in the code (at least of the Guzzle version I 've got). I know this part wasn't your code but I really struggled to follow the part of the middleware before having understood this. Thanks for clearing that out Gio. I hope this explanation helps others that are unfamiliar with this as well :)

  • @mamdouhzaq
    @mamdouhzaq 2 ปีที่แล้ว