I am trying to use Mandrill to send emails via my Laravel framework, however I am receiving the following error:
FatalErrorException in MandrillTransport.php line 114: Class 'GuzzleHttp\Client' not found
I have installed Guzzle using the following command in Terminal:
"guzzlehttp/guzzle": "~4.0"
According to Laravel's documentation I need to add "guzzlehttp/guzzle": "~4.0"
to my composer.json file, but I'm not sure if where I have placed it is correct as I still see the error.
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "^5.0",
"guzzlehttp/guzzle": "~4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
Here is the list of packages my application has, notice that guzzle has a different version: 4.2.3 which i've also tried updating to but still get the same error.
Open up your terminal at the root of your project and enter
composer require guzzlehttp/guzzle
It worked for the mailgun API. For some reason, the suggested method at the laravel's mail doc. You may install this package to your project by adding the following line to your composer.json
file
"guzzlehttp/guzzle": "~5.3|~6.0"
doesn't make the composer download the Guzzle
source codes. By the way, I didn't find out what |
means in determining the version. This command just downloads the PSR code.
In this moment, the solution may work. However, be aware of compatibility issues. Because the command would install the latest stable version, not the suitable one.
If you're using Laravel when you run into this error, just run:
composer require guzzlehttp/guzzle
And try again.
After updating your composer.json
file you need to run the update command to resolve and install your dependencies:
composer update
or, if composer isn't in your path:
php composer.phar update
Did you try :
artisan clear-compiled
or if artisan is not available try to remove compiled.php if exist (in vendor directory) and launch composer dumpautoload
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With