php-cassandra-binary
php-cassandra-binary copied to clipboard
Fatal error: Class 'evseevnn\Cassandra\Database' not found in
I'm starting try use this lib, but it have that error at index.php file My php is 5.5 My code here:
$nodes = [ 127.0.0.1' ]; try { // Connect to database. $database = new \evseevnn\Cassandra\Database($nodes, 'demodb'); $database->connect();
Please tell me how to fix!
Thanks
Hi, I am new to cassadra and searching for the php driver and got this one after implementing this i also get the same error! I tries to write an auto loader using spl_autoload_register() but failed to meet the driver requirement and sudenly i found "Unavailable exception" in the issue section of this project and i sure that additional files required(vendor directory, use composer to get the directory)
After composer install command you will get a "vendor" directory then use this code
namespace evseevnn; include_once(DIR.DIRECTORY_SEPARATOR."vendor".DIRECTORY_SEPARATOR."autoload.php");
$nodes = [
'127.0.0.1',
'127.0.0.1:9042' => [
'username' => '<user_name>',
'password' => '<password>'
]
];
// Connect to database.
$database = new Cassandra\Database($nodes, '<keyspace>');
$database->connect();
// Run query.
$users = $database->query('SELECT * FROM "test"');
var_dump($users);