/**
  * Performs the actual query on the database and returns the results
  * as an associative array. If there a no results, returns an empty array.
  *
  * @return Array
  * @throws \Exception
  */
 public function execute()
 {
     $this->validate();
     $query = $this->searchQuery;
     $countQuery = $this->searchQuery->composeCountQuery();
     $countResult = $this->db->query($countQuery);
     if (!$countResult) {
         throw new QueryFailedException('No valid result from Database, Error: ' . $this->db->error, $this->db->errno);
     }
     $result = $this->db->query($query);
     if (!$result) {
         throw new QueryFailedException('No valid result from Database, Error: ' . $this->db->error, $this->db->errno);
     }
     $this->searchResult = $result->fetch_all(MYSQLI_ASSOC);
     $this->numRows = count($this->searchResult);
     $this->totalRows = $countResult->fetch_row()[0];
     return $this->searchResult;
 }
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Alexschwarz89\EasyMysqliFulltext\SearchQuery;
use Alexschwarz89\EasyMysqliFulltext\Search;
$search = Search::createWithMYSQLi('localhost', 'username', 'password', 'dbname');
// You can access the newly created db instance, for example to set the charset
$search->db->set_charset('utf8');
// You can also create a new Search with an existing MYSQLi connection
// $search  = new Search($mysqliInstance)
$query = new SearchQuery($search);
$query->setTable('testdata')->setSearchFields('description')->mustInclude('example')->canInclude('another')->exclude('again');
$search->setSearchQuery($query);
$results = $search->execute();
if ($search->numRows > 0) {
    print "There are " . $search->numRows . "rows that match your search.\n";
    //var_dump($results)
} else {
    print "No results. \n";
}