私はLinux上で作曲をインストールしているので、私はこのようcomposer.jsonを編集した:Keen.ioのPHPクライアント(クラスが見つからない)
{
"name": "keen-io/keen-io",
"description": "A PHP library for reporting events to the Keen IO API",
"type": "library",
"license": "MIT",
"keywords": [
"keen io",
"analytics"
],
"support": {
"chat": "https://www.hipchat.com/gIdidQscL"
},
"require": {
"php": ">=5.3.3",
"ext-mcrypt": "*",
"guzzle/guzzle": "~3.7"
},
"require-dev": {
"phpunit/phpunit": "~3.7.0"
},
"homepage": "http://keen.io",
"autoload": {
"psr-4": {
"KeenIO\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"KeenIO\\Tests\\": "tests/Tests"
}
},
"authors": [
{
"name": "Tom Anderson",
"email": "[email protected]"
},
{
"name": "Keith Kirk",
"email": "[email protected]",
"homepage": "http://kmfk.io"
},
{
"name": "Michaël Gallego",
"email": "[email protected]",
"homepage": "http://michaelgallego.fr"
}
]
}
それから私は、作曲を更新するには、このコマンド$ composer update
を入力しています.jsonと./vendor/autoload.php
を生成します。このJSONの目的はkeen.ioに接続してPHPクライアントを使用することです。
は、私はこのPHPスクリプトコード化:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use KeenIO\Client\KeenIOClient;
$client = KeenIOClient::factory([
'projectId' => $projectId,
'writeKey' => $writeKey,
'readKey' => $readKey
]);
?>
をしかし、私は、スクリプトを実行すると、エラーは次のとおりです。
Fatal error: Class 'KeenIO\Client\KeenIOClient' not found in /opt/bitnami/apache2/htdocs/sandbox/keen.io/test-keen.php on line 9
-------------- -------------------------------------------------- ----------- ** scirpt.php:**
<?php
//* Composer Directory : /htdocs/sandbox/project/KeenClient-PHP/
//* Current Directory : ~/htdocs/sandbox/project/KeenClient- PHP/script.php
//* File_name : script.php
require_once __DIR__ .'/vendor/autoload.php';
use KeenIO\Client\KeenIOClient;
$client = KeenIOClient::factory([
'projectId' => "Project_ID",
'writeKey' => "Write_Key",
'readKey' => "Read_Key"
]);
?>
返信いただきありがとうございますが、私がgithubから取得したものと同じcomposer.jsonを使用して〜/ htdocs/sandbox/project/KeenClient-PHP/script.phpとしてこのディレクトリ内にscript.phpを置くと、https ://github.com/keenlabs/KeenClient-PHP。それは働いたが、私はscript.phpを任意のディレクトリ内に置くとエラーが表示される... – luka
script.phpを表示できますか?同じクラスのクラッシュが見つかりませんでしたエラー? –
私は元の回答の投稿にscript.phpを投稿します – luka