Class "KeenIO \ Client \ KeenIOClient" not found

I am including Keen in my product (code snippet below)

    require INCLUDE_DIR . '/vendor/autoload.php';   // Autoloader for Composer (https://getcomposer.org/)
    use KeenIO\Client\KeenIOClient;

    class Statistics extends Model {

        private $client;

        public function __construct( $id = null ){
            parent::__construct();
            $this->client = KeenIOClient::factory([
                'projectId' => KEEN_PROJECT_ID,
                'writeKey'  => KEEN_WRITE_KEY,
                'readKey'   => KEEN_READ_KEY
            ]);
        }
...

      

but I keep getting the "Class" KeenIO \ Client \ KeenIOClient "not found" error when running the "KeenIOClient :: factory" line. I was able to successfully install Keen.io via Composer - I feel like something simple I am missing - any ideas?

+3


source to share


1 answer


So I can't leave a comment, but I'm wondering if there is a problem with the include path? I managed to get this PHP snippet:

require 'vendor/autoload.php';
use KeenIO\Client\KeenIOClient;

$client = KeenIOClient::factory([
  'projectId' => "53f3a8687d8cb95095000001",
  'readKey' => "99a06e48fd7fb1279bc40995160eb0b61a9e0efaab8b651b029f0d895f77c0a804ba089282eff28bf8ad07f337422441d0542b7feaac9fea1e92fc153ee7efc51afad3276bda8d7754a338b349d540bfb402cba0dfdc82498c217054efd8abd0f47a0c0bc963bbdf0dc938c91b17d9f2"
]);

$count = $client->count('bitcoin-prices', [
  'impressions' => [
    'interval' => 'daily',
    'timeframe' => 'this_30_days',
    'group_by' => 'keen.timestamp'
  ]
]);

print_r($count);

      



The project ID and the read key are from many open datasets (good for testing).

+1


source







All Articles