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?
Laravel provides an expressive, minimal API around the Guzzle HTTP client, allowing you to quickly make outgoing HTTP requests to communicate with other web applications. Laravel's wrapper around Guzzle is focused on its most common use cases and a wonderful developer experience.
Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and trivial to integrate with web services. Simple interface for building query strings, POST requests, streaming large uploads, streaming large downloads, using HTTP cookies, uploading JSON data, etc...
//Create guzzle http client $client = new \GuzzleHttp\Client(); $res = $client->request('GET', 'https://api.github.com/user', [ 'auth' => ['user', 'pass'] ]); echo $res->getStatusCode(); // "200" echo $res->getHeader('content-type')[0]; // 'application/json; charset=utf8' echo $res->getBody(); // {"type":"User"...'
Guzzle has historically only utilized cURL to send HTTP requests. cURL is an amazing HTTP client (arguably the best), and Guzzle will continue to use it by default when it is available. It is rare, but some developers don't have cURL installed on their systems or run into version specific issues.
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.
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.
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