PHP code example of websmurf / laravel-cassandra
1. Go to this page and download the library: Download websmurf/laravel-cassandra library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
websmurf / laravel-cassandra example snippets
// Inject in the constructor
public function __construct(Cassandra $cassandra, Request $request)
{
$this->cassandra = $cassandra;
}
// Create prepared statement
$prepared = $this->cassandra->prepare('THIS IS MY CQL STATEMENT');
// Create options for execution
$options = new \Cassandra\ExecutionOptions([
'arguments' => $data,
'consistency' => \Cassandra::CONSISTENCY_ONE
]);
// Execute statement
$this->cassandra->execute($prepared, $options);
php artisan config:publish websmurf/laravel-cassandra