'Why "Class 'GuzzleHttp\Client' not found" even after Installing it in Laravel?
I've been reading answers from all the questions related to GuzzleHttp\Client
but situation is getting worst. I am trying to send E-mail Updates to all of my Application users using Laravel Queues. I don't know what's wrong but Jobs are failing.
I am properly caching the Exceptions and reporting them to laravel.log
file. Here is what I am getting when I try to execute queue worker.
[2018-03-23 11:43:06] production.ERROR: Class 'GuzzleHttp\Client' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class 'GuzzleHttp\\Client' not found at /home/polymath/saio/public_html/vendor/laravel/framework/src/Illuminate/Mail/TransportManager.php:181)
I've already installed GuzzleHttp\Client
using composer require guzzlehttp/guzzle
. It is successfully installed but still, I am getting the same error.
Even I tried to delete the current application files and clone my whole repository again. Still Facing the same issue. I even tried to clear caches using php artisan cache:clear
, php artisan cache:config
and php artisan clear-compiled
(This made my whole application crash) , php artisan dump-autoload
.
I can't find what's wrong but that's all logs say.
Solution 1:[1]
It seems you may need an older version of Guzzle to work with Laravel, try using Guzzle 3.x by updating your composer.json like such
"guzzlehttp/guzzle": "~3"
If you wish you can also try to use ~4
and see if Guzzle 4.x will work for you, remember to run composer update
and composer dump-autoload
after updating your composer.json file.
Update: This info is based on research since Laravel 4 and may be deprecated for Laravel 5.x
Solution 2:[2]
use GuzzleHttp\Client;
in your method Add
$client = new Client();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | HelloSpeakman |
Solution 2 |