Issue
I’m trying to run LaunchDarkly, but it says I need to initialize a class in my code
$client = new LDClient("MY_CLIENT_KEY");
This worked, but I got the following error
The error is in this code $stack = HandlerStack::create(); in GuzzleFeatureRequester.php. about to call
Use GuzzleHttp\HandlerStack.
However, this class does not exist when searched. Any thoughts on how to fix this?
I use this in my composer.json
"guzzlehttp/guzzle": "~5.3.0",
"launchdarkly/launchdarkly-php": "^2.0"
Solution
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.
Answered By – PaladiN
Answer Checked By – Senaida (Easybugfix Volunteer)