2

A plugin that is using a Guzzle request is now throwing an exception that the class cannot be found.

I'm running Craft CMS 2.6.3000. Where is Guzzle being pulled from? I can see it within craft/app/vendor/guzzle and also within plugins/oauth/vendor but for some reason this plugin cannot cannot use this class anymore.

It is being referenced as $client = new \GuzzleHttp\Client();

Why can't the class be used?

2 Answers 2

1

Just a quick guess, but here is what I have on a project I am working on.

$client = new \Guzzle\Http\Client();
$request = $client->get($url);

yours

$client = new \GuzzleHttp\Client();

mine

$client = new \Guzzle\Http\Client();

I have \Http\Client - maybe you are just missing the slash?

2
  • What's weird though is its been working like this for a while. Maybe a plugin update has caused this, I'm not sure. Dec 13, 2017 at 18:29
  • I get Call to undefined method Guzzle\Http\Client::request() when using that version for $client. Dec 13, 2017 at 18:36
0

Actually the class to be used should be:

$client = new GuzzleHttp\Client();

without the first back slash

1
  • This should be posted as comment on the accepted answer, which includes the bulk of this information—but may contain syntactic issues for some environments. Oct 20, 2021 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.