Brian Erickson
Brian Erickson

Reputation: 31

Class 'GuzzleHttp\Client' not found Converage Api

Fatal error: Class 'GuzzleHttp\Client' not found in ConvergeApi.php on line 123

Download and installed code from https://github.com/markroland/converge-api-php

CentOS 7 PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Installed composer

right now I am just tring to get the examples working.

The machine is clean, fresh install I have followed various example and suggestions posted on StackOverflow. Any ideas. The full code is in the link above.

Upvotes: 1

Views: 1578

Answers (3)

Baul
Baul

Reputation: 5

You are not using the vendor/autoload.php :) you commented it.

All you need to do is uncomment the following line:

require dirname(__DIR__) . '/vendor/autoload.php'; 

Which is part of a file located in your examples folder.

Make sure you load it before trying to make any GuzzleHttpClient.

Upvotes: 0

Object.debug
Object.debug

Reputation: 281

You can do following steps to execute your code:

  1. Go to your project dir where composer.json resides

  2. Install the dependencies using composer install command

converge-api-php> composer install

composer install command - parses composer.json file & downloads needed dependencies in vendor directory

  1. Now you can see a new directory named vendor in your project dir
  2. This vendor dir contains a file autoload.php, We need to include this file in order to autoload any class dependencies (Eg: GuzzleHttp\Client)
  3. cd into converge-api-php\examples\ccsale.php file & require vendor/autoload.php file at the top

// inside examples\ccsale.php require(__DIR__.'./../vendor/autoload.php');

Now try to execute examples\ccsale.php file.

Additionally, you can also execute your php-unit test cases with following command:

converge-api-php$ ./vendor/bin/phpunit ./tests/ConvergeApiTest.php

I hope this was helpful.

Upvotes: 1

Khetesh kumawat
Khetesh kumawat

Reputation: 711

Go to your composer director and open the CMD command type this line,

for example:-

C:\Windows\system32>composer      //first line 

C:\Windows\system32> cd D:\filedir

D:\filedir>composer update    // enter updating  composer 

Upvotes: 0

Related Questions