1

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.

6
  • Have you installed composer, than composer is update all file auto generate Commented Jun 27, 2017 at 1:59
  • composer-dump-autoload -o Commented Jun 27, 2017 at 2:00
  • I have updated from php 5.4 to php 7.1 Commented Jun 27, 2017 at 19:45
  • I have updated from php 5.4 to php 7.1. ran 'composer dump-autoload -o' ran example 'ccsales.php' got the following error "Fatal error: Uncaught Error: Class 'GuzzleHttp\Client' not found in ConvergeApi.php:123 Stack trace: #0 ConvergeApi.php(153): markroland\Converge\ConvergeApi->httpRequest('ccsale', Array) #1 ConvergeApi.php(254): markroland\Converge\ConvergeApi->sendRequest('ccsale', Array) #2 ccsale.php(18): markroland\Converge\ConvergeApi->ccsale(Array) #3 {main} thrown in ConvergeApi.php on line 123" Commented Jun 27, 2017 at 19:54
  • The output for "composer dump-autoload -o" was Generating optimized autoload files Commented Jun 27, 2017 at 19:55

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That helped and moved me forward. Now, I get ConvergeApi->ccsale Response: Array ( [errorCode] => 4025 [errorName] => Invalid Credentials [errorMessage] => The credentials supplied in the authorization request are invalid. ) . Is there a problem with my ssl certificate?
Yes, now the issue is with the credential info passed while creating instance of ConvergeApi .$PaymentProcessor = new \markroland\Converge\ConvergeApi( 'YOUR_CONVERGE_MERCHANTID', 'YOUR_CONVERGE_USERID', 'YOUR_CONVERGE_PIN', false );
@BrianErickson, please accept the answer if this was helpful.
0

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 

2 Comments

I am using Linux not windows
Please share more details. What makes you think that the given commands resolve the problem?
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.