title: Uncaught Error: Class "GuzzleHttp\Promise\EachPromise"
body: <p>I tried implementing the below code but it is showing the <code>EachPromise Error class not found</code> and <code>Promise Error class not found</code>. Guzzle library is installed. Then also this error was there.</p>
  <pre><code>&lt;?php
  
  use GuzzleHttp\Promise\EachPromise;
  use GuzzleHttp\Psr7\Response;
  
  $users = ['one', 'two', 'three'];
  
  $promises = (function () use ($users) {
      foreach ($users as $user) {
          
          // Using generator
          yield $this-&gt;getAsync(
  'https://api.demo.com/v1/users?username='
          . $user);       
      }
  })();
  
  $eachPromise = new EachPromise($promises, [
      
      // Number of concurrency
      'concurrency' =&gt; 4,
      'fulfilled' =&gt; function (Response $response) {
          if ($response-&gt;getStatusCode() == 200) {
              $user = json_decode(
                  $response-&gt;getBody(), true);
              
              // processing response of the user
          }
      },
      
      'rejected' =&gt; function ($reason) {
      // handle promise rejected
      }
  ]);
  $eachPromise-&gt;promise()-&gt;wait();
  ?&gt;
  </code></pre>