Http client cache #33718
Unanswered
gregorip02
asked this question in
General
Http client cache
#33718
Replies: 1 comment 2 replies
-
You can add middleware to http client <?php
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Http;
use GuzzleHttp\HandlerStack;
use Kevinrob\GuzzleCache\CacheMiddleware;
$stack = HandlerStack::create();
$stack->push(new CacheMiddleware(), 'cache');
$options = ['handler' => $stack];
// Supply guzzle options to client
$response = Http::withOptions($options)->get('http://example.com');
dump($response); |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Hi there.
I am wondering if I can add cache to my http clients. Currently I can't find any particular method within the
Illuminate\Http\Client\PendingRequest
class to help me with this.Beta Was this translation helpful? Give feedback.
All reactions