Posts tagged with guzzle
Convert Guzzle requests to curl commands
I came across this cool package that helped me debug a weird request performed by Guzzle.
Read more [github.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
"Freek publishes a super resourceful and practical newsletter. A must for anyone in the Laravel space"
No spam. Unsubscribe anytime. You can also follow me on X.
Fake Guzzle responses using a MockHandler
⚗️ One of the most common integrations developers struggle to test is Guzzle. Fortunately, it has a `MockHandler` you can set up to return predefined responses.
— Jason McCreary (@gonedark) 23 december 2019
Since it uses the existing `Client` and `Response` objects, there's no need to change your implementation. pic.twitter.com/Ui2Zyqj2Lt
Read more [twitter.com]
Using Guzzle 6 Middleware in a Laravel Application
Paul Redmond explains how you can use Guzzle 6' middleware to add a HMAC authorization header.
I prefer to keep my dependencies as up-to-date as possible so I decided to learn Guzzle 6 and become more familiar with the middleware. The concepts are pretty straightforward and I have a few patterns that I like to use when building out middleware within my Laravel applications.
https://medium.com/@paulredmond/using-guzzle-6-middleware-in-a-laravel-application-7fbd6d966235
Concurrent HTTP requests without opening too many connections
Hannes Van De Vreken shows what awesome async things you can do with Guzzle promises.
Now what happens if you need to perform a large number of concurrent requests? If you don’t control the number of requests you might end up with a dangerously large amount of open TCP sockets to a server. You’ll need to use some sort of dispatching to have a limited number of concurrent requests at any given time.https://blog.madewithlove.be/post/concurrent-http-requests/Let’s show you how to do that.