MadzQuestioning
MadzQuestioning

Reputation: 3762

Class 'GuzzleHttp\HandlerStack' not found

I'm trying to run LaunchDarkly and within the code it says that I need to initialize my class like so

$client = new LDClient("MY_CLIENT_KEY");

Now I was able to do that but an error occured below is the error

enter image description here

The error is within this code $stack = HandlerStack::create(); inisde the GuzzleFeatureRequester.php. Its trying to call

use GuzzleHttp\HandlerStack;

but this class does not exist when searching. Any idea on how to fix this? I'm using this on my composer.json

"guzzlehttp/guzzle": "~5.3.0",
"launchdarkly/launchdarkly-php": "^2.0"

Upvotes: 8

Views: 7625

Answers (2)

saber tabatabaee yazdi
saber tabatabaee yazdi

Reputation: 4959

your laravel version should be compatible with guzzle versions

Laravel 5.8: Guzzle ^6.0 (https://github.com/laravel/framework/blob/v5.8.38/composer.json#L124) Laravel 6: Guzzle ^6.3.1|^7.0.1(https://github.com/laravel/framework/blob/v6.20.2/composer.json#L126) Laravel 7: Guzzle ^6.3.1|^7.0.1 (https://github.com/laravel/framework/blob/v7.29.2/composer.json#L132) Laravel 8: Guzzle ^6.5.5|^7.0.1 (https://github.com/laravel/framework/blob/v8.12.3/composer.json#L135)

Upvotes: 0

PaladiN
PaladiN

Reputation: 4944

Have you looked at the dependency of the launchdarkly-php?

It uses guzzlehttp v6.

Want the proof it's over here:

Just have a look at the composer.json over here:

https://github.com/launchdarkly/php-client/blob/master/composer.json#L22

"guzzlehttp/guzzle": "^6.2.1",

And since you are working on guzzle v5 there is no any class that you have specified.

So, if you are trying to work on launchdarkly v2 sdk try to upgrade to guzzlehttp v6.

Else as you mentioned that there is more dependency with guzzlehttp v5 then you need to use:

"launchdarkly/launchdarkly-php": "0.7.0"

Hope this helps you.

Upvotes: 8

Related Questions