Download the PHP package airnox/laravel-scout-mysql-driver without Composer

On this page you can find all versions of the php package airnox/laravel-scout-mysql-driver. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-scout-mysql-driver

Laravel Scout MySQL Driver

Search Eloquent Models using MySQL FULLTEXT Indexes or WHERE LIKE '%:search%' statements.

  1. Installation
  2. Usage
  3. Modes
  4. Console Command
  5. Configuration

Installation

Note: Any Models you plan to search using this driver must use a MySQL MyISAM or InnoDB table.

If you haven't already you should install Laravel Scout to your project and apply the Laravel\Scout\Searchable trait to any Eloquent models you would like to make searchable.

Install this package via Composer

composer require yab/laravel-scout-mysql-driver

Next add the ServiceProvider to the Package Service Providers in config/app.php

Append the default configuration to config/scout.php

Set SCOUT_DRIVER=mysql in your .env file

Please note this Laravel Scout driver does not need to update any indexes when a Model is changed as this is handled natively by MySQL. Therefore you can safely disable queuing in config/scout.php.

In addition there is no need to use the php artisan scout:import command. However, if you plan to use this driver in either NATURAL_LANGUAGE or BOOLEAN mode you should first run the provided console command to create the needed FULLTEXT indexes.

Usage

Simply call the search() method on your Searchable models:

$beers = App\Drink::search('beer')->get();

Or With pagination:

$beers = App\Drink::search('beer')->paginate(15);

Simple constraints can be applied using the where() builder method (each additional WHERE will be applied using AND).

$beers = App\Drink::search('beer')->where('in_stock', 1)->get();

The following operators can be applied to the WHERE statements: <> != = <= < >= > (= will be used if no operator is specified)

$beers = App\Drink::search('beer')->where('abv >', 10)->get();

For more usage information see the Laravel Scout Documentation.

Modes

This driver can perform different types of search queries depending on the mode set in the scout.mysql.mode Laravel configuration value. Currently 4 different modes are supported NATURAL_LANGUAGE,BOOLEAN,LIKE and LIKE_EXPANDED.

NATURAL_LANGUAGE and BOOLEAN Modes

In NATURAL_LANGUAGE and BOOLEAN mode the driver will run MySQL WHERE MATCH() AGAINST() queries in the respective modes.

Both modes search queries will include all of Model's FULLTEXT compatible fields (CHAR,VARCHAR,TEXT) returned from the Model's toSearchableArray() method. It is required to have a FULLTEXT index for these fields. You can create this index using the provided console command.

For example running a search on a POST model with the following database structure:

column name type
id int(10) UN AI PK
content VARCHAR(255)
meta TEXT

would produce the following query in NATURAL_LANGUAGE mode:

and the following query in BOOLEAN mode:

Operators for BOOLEAN mode should be passed as part of the search string.

For more information see the MySQL's Full-Text Search Functions documentation.

LIKE and LIKE_EXPANDED Modes

LIKE and LIKE_EXPANDED modes will run WHERE LIKE %?% queries that will include all of the Model's fields returned from toSearchableArray(). LIKE_EXPANDED mode will query each field using each individual word in the search string.

For example running a search on a Customer model with the following database structure:

column name type
id int(10) UN AI PK
first_name VARCHAR(255)
last_name VARCHAR(255)

would produce the following query in LIKE mode given the search string "John":

and the following query in LIKE_EXPANDED mode given the search string "John Smith":

Console Command

The command php artisan scout:mysql-index {model?} is included to manage the FULLTEXT indexes needed for NATURAL_LANGUAGEand BOOLEAN modes.

If the model parameter is omitted the command will run with all Model's with the Laravel\Scout\Searchable trait and a MySQL connection within the directories defined in the scout.mysql.model_directories Laravel configuration value.

Creating Indexes

Pass the command a Model to create a FULLTEXT index for all of the Model's FULLTEXT compatible fields (CHAR,VARCHAR,TEXT) returned from the Model's toSearchableArray() method. The index name will be the result of the Model's searchableAs() method.

If an index already exists for the Model and the Model contains new searchable fields not in the existing index the index will be dropped and recreated.

php artisan scout:mysql-index App\\Post

Dropping index

Pass the -D or --drop options to drop an existing index for a Model.

php artisan scout:mysql-index App\\Post --drop

Configuration

Behavior can be changed by modifying the scout.mysql Laravel configuration values.


All versions of laravel-scout-mysql-driver with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
laravel/framework Version 5.3.*|5.4.*|5.5.*|5.6.*|5.7.*
laravel/scout Version ^2.0|^3.0|^4.0|^5.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package airnox/laravel-scout-mysql-driver contains the following files

Loading the files please wait ....