Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mvnobrega's avatar

How to install two versions of guzzleHttp?

I have an old version that was installed with composer and is inside vendor/guzzlehttp , and I downloaded the latest version and saved it in the guzzlehttpNew folder. However, when I try to use it like this:

use guzzleHttpNew\Client;

$client = new Client();
 $response = $client->request('POST', 'https://www.site.com.br/upload-image-blog', [
 'multipart' => [
 [
 'name' => 'image',
 'contents' => $request->file('thumbnail'),
 'filename' => $imageName,
 '_token' => csrf_token()
 ],
 ],
 ]);

I get this error:

"message": "Class \"guzzleNewNew\Client\" not found",

What else do I need to do to be able to use both versions at the same time?

0 likes
4 replies
jlrdw's avatar

Do you really need both? Maybe backup first and just try the newest one.

1 like
mvnobrega's avatar

@jlrdw The problem is that I'm using a very complex Goutte scraper that only works in version 7.2 of guzzlehttp, in the current version I get several errors that I can't resolve. But I will look for another alternative

mvnobrega's avatar

@jlrdw In fact, it's not with Goutte, it's with Amazon's API that I have problems. But I'm going to delete this topic, I'm going to look for another solution, thanks for the help

puklipo's avatar

You can't use two versions at the same time.

Don't download guzzle directly. Update it with composer.

composer update

If the major versions are different, change composer.json.

1 like

Please or to participate in this conversation.