title: PHP Fatal error: Uncaught Error: Class 'http\\Client' not found http_request2
body: <p>I am trying to set up a safety pasarela using http_request2
  (<a href="https://documenter.getpostman.com/view/10111708/TVmLCykr" rel="nofollow noreferrer">https://documenter.getpostman.com/view/10111708/TVmLCykr</a>)
  Use composer</p>
  <pre><code>$ /usr/local/bin/composer info
  
  guzzlehttp/guzzle 7.2.0 Guzzle is a PHP HTTP client library
  guzzlehttp/promises 1.4.0 Guzzle promises library
  guzzlehttp/psr7 1.7.0 PSR-7 message implementation that also provides common utility methods
  pear/http_request2 v2.4.2 Provides an easy way to perform HTTP requests.
  pear/net_url2 v2.2.2 Class for parsing and handling URL. Provides parsing of URLs into their constituent parts (scheme, host, path etc.), URL generation, and resolving of relative URLs.
  pear/pear_exception v1.0.1 The PEAR Exception base class.
  transfer class for PHP
  psr/http-client 1.0.1 Common interface for HTTP clients
  psr/http-message 1.0.1 Common interface for HTTP messages
  ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
  </code></pre>
  <p>I verified that I have pear installed
  pear run-tests -r Running 0 tests TOTAL TIME: 00:00 0 PASSED TESTS 0 SKIPPED TESTS
  my file:</p>
  <pre><code>require_once __DIR__ . '/vendor/autoload.php';
  $client = new http\Client;
  $request = new http\Client\Request;
  $request-&gt;setRequestUrl('https://sandbox-mws.safetypay.com/mpi/api/v1/online-payment-requests');
  
  $request-&gt;setRequestMethod('POST');
  $body = new http\Message\Body;
  $body-&gt;append('{
      &quot;sales_amount&quot;: {
          &quot;value&quot;: 50,
          &quot;currency_code&quot;: &quot;USD&quot;
      },
      &quot;shopper&quot;: {
          &quot;phone&quot;: {
              &quot;phone_type&quot;: &quot;Mobile&quot;,
              &quot;phone_country_code&quot;: &quot;51&quot;,
              &quot;phone_number&quot;: &quot;9999999999&quot;,
              &quot;is_sms_enabled&quot;: false
          },
          &quot;shopper_type&quot;: &quot;Person&quot;,
          &quot;first_name&quot;: &quot;Joe&quot;,
          &quot;last_names&quot;: &quot;Doe&quot;
      },
      &quot;payment_ok_url&quot;: &quot;https://www.safetypay.com/success.com&quot;,
      &quot;payment_error_url&quot;: &quot;https://www.safetypay.com/error.com&quot;,
      &quot;filter_payment_by&quot;: &quot;Channel(OL)&quot;,
      &quot;merchant_set_pay_amount&quot;: false,
      &quot;expiration_time_minutes&quot;: 120,
      &quot;language_code&quot;: &quot;EN&quot;,
      &quot;custom_merchant_name&quot;: &quot;M_TEST&quot;,
      &quot;merchant_sales_id&quot;: &quot;FirstTest&quot;,
      &quot;requested_payment_type&quot;: &quot;StandardorBoleto&quot;,
      &quot;application_id&quot;: &quot;1&quot;,
      &quot;transaction_email&quot;: &quot;jdoe@test.com&quot;,
      &quot;send_email_shopper&quot;: false,
      &quot;request_datetime&quot;: &quot;2020-09-16T21:06:16.61&quot;
  }');
  $request-&gt;setBody($body);
  $request-&gt;setOptions(array());
  $request-&gt;setHeaders(array(
    'X-Api-Key' =&gt; '5edd536ed98449692ef24e6883ebb95d',
    'X-Version' =&gt; '20200803'
  ));
  $client-&gt;enqueue($request)-&gt;send();
  $response = $client-&gt;getResponse();
  echo $response-&gt;getBody();
  </code></pre>
  <p>But I keep getting the error:</p>
  <blockquote>
  <p>[php7:error] [pid 2653] [client 190.x.105.x:54x7] PHP Fatal error: Uncaught Error: Class 'http\Client' not found in /var/www/html/safetyPay.php:3\nStack trace:\n#0 {main}\n thrown in /var/www/html/safetyPay.php on line 3</p>
  </blockquote>