phpでGoogleのNatural Language APIで遊んでいるだけですが、単純な例を実行できないようです。致命的なエラー:キャッチされていないエラー:クラス 'LanguageClient'が見つかりません
<?php
# Imports the Google Cloud client library
use Google\Cloud\Language\LanguageClient;
# Your Google Cloud Platform project ID
$projectId = '<My Project Name>';
# Instantiates a client
$language = new LanguageClient([
'projectId' => $projectId
]);
# The text to analyze
$text = 'Hello, world!';
# Detects the sentiment of the text
$annotation = $language->analyzeSentiment($text);
$sentiment = $annotation->sentiment();
echo 'Text: ' . $text . 'Sentiment: ' . $sentiment['score'] . ', ' . $sentiment['magnitude'];
>
しかし、それは、このエラーを思い付く:?ここ
は私のPHPのための基本的です
Fatal error: Uncaught Error: Class 'LanguageClient' not found in /User/zan/Zan/classifier/test.php:11
Stack trace:
#0 {main}
thrown in /Users/zan/Zan/classifier/test.php on line 11
私はグーグル/雲をインストールするために作曲を使用しますが、なぜそれがLanguageClientを見つけることができないのかを知りません。誰かが私を正しい方向に向けることができますか?
あなたのプロジェクトIDは公開されるべきですか? – Martin