how to Install Guzzle into Laravel 5? I'm using laravel for my project, but I need library like guzzle to made me easy using curl in laravel. Any Body can help?
6 Answers
Open a terminal, change into your laravel projects root dir and type
composer require guzzlehttp/guzzle
Alternatively, you can add
"guzzlehttp/guzzle":"*"
to your composer.json file's require section and run composer update.

- 71,625
- 17
- 143
- 203
-
how to implement guzzle as library or helper? – Rahman Jul 31 '15 at 08:25
-
implementation, and calling into controller – Rahman Jul 31 '15 at 08:32
-
1@baao this should be updated to `composer require guzzlehttp/guzzle` - since `composer require guzzle/guzzle` has been abandoned - see https://packagist.org/packages/guzzle/guzzle – goredwards Jan 19 '17 at 00:59
-
I'm banging my head here... I'm getting Class 'Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory' not found – MiloTheGreat Jun 02 '18 at 12:32
Via composer, cd into your laravel's project root directory, then
composer require guzzlehttp/guzzle
That's much it. Now guzzle is installed and ready to use.

- 459
- 5
- 15
Add into composer.json requirements
"guzzlehttp/guzzle": "5.*"
(5.* is Guzzle version, it could be change see more in guzzle github profile)
after editing run:
composer update
For more, see Guzzle.

- 47,830
- 31
- 106
- 135

- 31
- 3
Since Guzzle is a generic PHP package and not specifically built for Laravel, it is a little bit confusing to Laravel users because you cannot use the class function "statically".
To install and use Guzzle in Laravel 5 (I use it in Laravel 5.7),
composer require guzzlehttp/guzzle
You should then see guzzlehttp folder in vendor folder.
To use it, you can
use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client as GuzzleClient;
...
public function testGuzzle()
{
$client = new GuzzleClient();
...
}
If you do not want to import the namespace, you can also directly use it as below
$client = new \GuzzleHttp\Client();
As mentioned before, you cannot use it "statically"
GuzzleClient::request('GET', 'https://api.xxxx'); // this will throw you error.

- 1,237
- 16
- 17
This could be easily accomplished by using the following repo https://github.com/Bogardo/Mailgun
I believe the above link will have no issue with guzzlehttp 5.3 ~ 6.0
However if you are using Oauth with guzzle version above 6.0, compare "/composer.json", "/src/Bogardo/Mailgun/Mailgun/MailgunApi.php" files between above link and below. https://github.com/milocosmopolitan/Mailgun

- 130
- 8
Add to your composer.json
file in require:
"guzzlehttp/guzzle": "~5.0"
save and then update your composer.

- 5,562
- 2
- 29
- 50

- 131
- 3
- 14