Often in our applications we need to make HTTP requests to external services either to integrate with an API, upload a file to S3, or perform some other action that requires us to interface over HTTP. PHP doesn’t natively make these requests user friendly so many of us turn to the 3rd-party library Guzzle. But how well do you know Guzzle beyond the basics?

Guzzle is much more than syntactic sugar for HTTP requests. PHP is a synchronous language by nature, but did you know that you can make asynchronous HTTP requests out of the box with Guzzle? It’s functionality extends even further with support for custom request handlers and middleware.

In this talk we’ll start with some basic example requests using Guzzle. Then we’ll look at extending our requests with middleware such as logging, retry middleware, handling failed requests, and mapping responses from 3rd-party APIs. From there, we’ll refactor our synchronous requests to be asynchronous using promises and generators to process our async responses. Finally, we’ll look at how to test our requests without needing to send them over the internet. You’ll leave this presentation with a deeper understanding of the power of Guzzle, how to extend it with your own middleware, how to speed up your application with async requests and how to test your requests without external dependencies.

Comments

Comments are closed.

Eric Poe at 15:06 on 3 May 2019

I learned some new things about Guzzle and will need to look further into it.

Kendra Jones at 15:32 on 3 May 2019

Lots of information and I loved the step by step code walk-through

Roger Creasy at 20:03 on 3 May 2019

Steven always does a great job. In this talk he makes points, then follows them with code examples to back them up. There is a ton of information in this talk; it moves quickly, but Steven explains things very well. I learned much and am taking away things I need to explore further.

Roy Hughes at 14:35 on 4 May 2019

Very well presented talk - we use Guzzle already, but this pointed to better use scenarios!