承接 alexschwarz89/easy-mysqli-fulltext 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

alexschwarz89/easy-mysqli-fulltext

最新稳定版本:2.0.0

Composer 安装命令:

composer require alexschwarz89/easy-mysqli-fulltext

包简介

An easy-to-use Library to perform ranked MYSQLi fulltext searches

README 文档

README

An easy-to-use Library to perform ranked fulltext searches with MYSQLi.

SensioLabsInsight Latest Stable Version License composer.lock GetBadges Game

Install

Install via composer:

{
    "require": {
        "alexschwarz89/EasyMysqliFulltext": "2.0.0"
    }
}

Run composer install.

Getting Started

You will find a example file in examples/index.php to use with the included testdata.sql.

Set up search on a existing MYSQLi connection

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

Simply searching for "example" in our testdata

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

You can also

Use Search without an existing MYSQLi connection

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

You can also pass the connection variables via Environment Variable (.env) and just Use

$search = Search::createWithMYSQLi();

.env file saved in your root directory

DATABASE_HOST=localhost
DATABASE_USERNAME=username
DATABASE_PASSWORD=password
DATABASE_NAME=database_name

Build more complex search queries

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

Contributing is surely allowed! :-)

统计信息

  • 总下载量: 60
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-26