title: PHP - Google Speech API: Class 'Google\Cloud\Speech\SpeechClient' not found
body: <p>I was hoping someone could help me figure out how to get google's speech to text api running. </p>
  
  <p><a href="https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/speech/api" rel="nofollow noreferrer">https://github.com/GoogleCloudPlatform/php-docs-samples/tree/master/speech/api</a></p>
  
  <p>The specific code I'm trying to run is: src/functions/transcribe_sync.php</p>
  
  <p>with a line added at the end to call the function:</p>
  
  <pre><code>transcribe_sync("mono.flac", 'en-US');
  </code></pre>
  
  <p>It can't locate a dependency. I've been playing around with composer but haven't been able to figure it out. </p>
  
  <p>Heres the error:</p>
  
  <pre><code>php transcribe_sync.php
  PHP Fatal error:  Uncaught Error: Class 'Google\Cloud\Speech\SpeechClient' not found in /home/bhaag/Documents/php-docs-samples-master/speech/api/src/functions/transcribe_sync.php:45
  Stack trace:
  #0 /home/bhaag/Documents/php-docs-samples-master/speech/api/src/functions/transcribe_sync.php(55): Google\Cloud\Samples\Speech\transcribe_sync('mono.flac', 'en-US')
  #1 {main}
    thrown in /home/bhaag/Documents/php-docs-samples-master/speech/api/src/functions/transcribe_sync.php on line 45
  </code></pre>
  
  <p>Heres my composer.json file:</p>
  
  <pre><code>{
      "require": {
          "google/cloud-speech": "^0.2",
          "google/cloud-storage": "^1.0",
          "google/gax": "^0.8.1",
          "google/proto-client-php": "^0.10.0",
          "symfony/console": "^3.0",
          "php-ffmpeg/php-ffmpeg": "^0.9.3"
      },
      "autoload": {
          "psr-4": {
              "Google\\Cloud\\Samples\\Speech\\": "src/"
          },
          "files": [
              "src/functions/streaming_recognize.php",
              "src/functions/transcribe_async.php",
              "src/functions/transcribe_async_gcs.php",
              "src/functions/transcribe_sync.php",
              "src/functions/transcribe_sync_gcs.php"
          ]
      },
      "require-dev": {
          "phpunit/phpunit": "~4"
      }
  }
  </code></pre>
  
  <p>I've been able to get the full speech sample running so I know I have all the credentials set up correctly but it seemed really cryptic to work with  the full sample (speech.php in the main directory). </p>
  
  <p>Am I going about this the wrong way? Thanks for any help!</p>