-1

I am pretty new in PHP and Laravel and I am finding some difficulties trying to add Guzzle library (can I call it library in PHP slang, I came from Java...).

So I followed the suggestion of this SO post: Installation Guzzle in Laravel 5

I have added this dependency into my composer.json file: "guzzle/guzzle":"*"

I have added it into this section of the original file (generated by Laravel):

"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.0",
    "symfony/css-selector": "3.1.*",
    "symfony/dom-crawler": "3.1.*",
    "guzzle/guzzle":"*"
},

I don't know if it is the right location.

Then I performed the composer update statment into my shell (from the root directory of my project) and I obtain this output:

Andrea@Andrea-PC MINGW64 ~/Documents/Betrivius/WorkSpace/betriviusExtranet (master)
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead.
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled class file has been removed.

I see no error so I think that it is successfully completed.

The problem is that I can't find these dependency into my project and when before a class definitio I try to use it:

use GuzzleHttp\Exception\GuzzleException;
use GuzzleHttp\Client;

I obtain this error message:

Undefine namespace
Referenced namespace is not found

In the specific I obtain an error message on these 4 red namespaces:

enter image description here

Why? What is wrong? What am I missing? How can I fix this issue?

Community
  • 1
  • 1
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
  • 1
    > Package guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead. – yivi Jan 24 '17 at 14:30

2 Answers2

3

As stated, you should use guzzlehttp/guzzle, instead of guzzle/guzzle.

If you really need to use guzzle/guzzle, you can import it via Guzzle namespace, not GuzzleHttp, which is reserved for new version.

jdrzejb
  • 116
  • 4
2

guzzle/guzzle is abandoned, you should avoid using it. Use guzzlehttp/guzzle instead

Use guzzlehttp/guzzle

John Smith
  • 1,091
  • 9
  • 17