PHP code example of alexschwarz89 / easy-mysqli-fulltext

1. Go to this page and download the library: Download alexschwarz89/easy-mysqli-fulltext 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/ */

    

alexschwarz89 / easy-mysqli-fulltext example snippets


use \Alexschwarz89\EasyMysqliFulltext\Search;
$search = new Search( $mysqliInstance );

$query = new SearchQuery($search);
$query->setTable('testdata')
    ->setSearchFields('description')
    ->mustInclude('example');
    
$search->setSearchQuery( $query );
try {
    $search->execute();
} catch (EmptySearchTermException $e) {
    // Handle invalid search terms
}

$search = Search::createWithMYSQLi('localhost', 'username', 'password', 'dbname');

$search = Search::createWithMYSQLi();

$query->setTable('testdata') 
    ->setSearchFields('description,title,isbn,author')
    ->mustInclude('example')
    ->canInclude('another')
    ->exclude('again')
    ->preferWithout('this')
    ->orderBy('some_field', 'ASC');