Download the PHP package baril/sqlout without Composer

On this page you can find all versions of the php package baril/sqlout. 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 sqlout

Sqlout :dolphin:

Version License Downloads Tests Coverage

Sqlout is a MySQL driver for Laravel Scout. It indexes the data into a dedicated table of the MySQL database, and uses a fulltext index to search. It is meant for small-sized projects, for which bigger solutions such as ElasticSearch would be an overkill.

Sqlout is different than Scout's native Database engine because it indexes data in a separate, dedicated table, and uses a fulltext index. Sqlout has more features such as field weights and word stemming.

Sqlout is compatible with Laravel 5.8+ to 12.x and Scout 7.1+ / 8.x / 9.x / 10.x (credit goes to ikari7789 for Laravel 9 and 10 / Scout 9 and 10 support).

You can find the full API documentation here.

Version compatibility

Laravel Scout Sqlout
11.x / 12.x 10.x 5.1+
9.x / 10.x 10.x 5.x
8.x / 9.x 9.x 4.x
8.x 8.x 3.x
7.x 8.x 2.0
6.x 8.x 2.0
6.x 7.1 / 7.2 1.x / 2.0
5.8 7.1 / 7.2 1.x / 2.0

Setup

Require the package:

Publish the configuration:

If you're not using package discovery, manually add the service providers (Scout's and Sqlout's) to your config/app.php file:

Creating the index

Models are indexed in a separate table. You can either create a single table and use it as a global index for all models, or create 1 index table per model (or a mix of both).

Global index

The default name for the table is searchindex. If you want to use a different name, you can configure it in config/scout.php:

Then, migrate your database:

This will create the searchindex table (or whatever name you've configured).

Different connections

If you want to index models that belong to different connections, you need an index table per connection. To create the table on a connection that is not the default connection, you can call the sqlout:make-migration command and pass the name of the connection:

Separate indexes

If you prefer to index each model in a different table, set the global index name to an empty string:

Each model will be indexed in a table named like the model table followed by _index, eg. the Post model will be index in posts_index.

You can configure a different suffix, and also a prefix, in the config file:

You can also customize the table name for each model with the searchableAs method (see next section).

Once you're set up, create the index table for your models like this:

Making a model searchable

The example above is similar to what is described in Scout's documentation, with the following differences/additions:

Once this is done, you can index your data using Scout's Artisan command:

Your models will also be indexed automatically on save.

Searching

Basics

See Scout's documentation for more details.

Sqlout's builder also provides the following additional methods:

Using scopes

With Sqlout, you can also use your model scopes on the search builder, as if it was a query builder on the model itself. Similarly, all calls to the where method on the search builder will be forwarded to the model's query builder.

:warning: Keep in mind that these forwarded scopes will actually be applied to a subquery (the main query here being the one on the searchindex table). This means that for example a scope that adds an order by clause won't have any effect. See below for the proper way to order results.

If the name of your scope collides with the name of a method of the Baril\Sqlout\Builder object, you still have the option to use Scout's query method:

Search modes

MySQL's fulltext search comes in 3 flavours:

Sqlout's default mode is "natural language" (but this can be changed in the config file).

You can also switch between all 3 modes on a per-query basis, by using the following methods:

Ordering the results

If no order is specified, the results will be ordered by score (most relevant first). But you can also order the results by any column of your table.

In the example below, the results will be ordered by status first, and then by descending score.

Filters, tokenizer, stopwords and stemming

In your config file, you can customize the way the indexed content and search terms will be processed:

In the example, the stemmer comes from the package wamania/php-stemmer, but any class with a stem method, or anything callable such as a closure, will do.

As for stopwords, you can either list them directly in the config (as shown above), or load them from a file. The file can be either a TXT file (with one stopword per line), or a PHP file that returns an array:

You may want to use the package voku/stop-words, which provides collections of stopwords for various languages as PHP files, or yooper/stop-words, which provides them as TXT files.


All versions of sqlout with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
illuminate/database Version ^8.79|^9.46|^10.0|^11.0|^12.0
illuminate/support Version ^8.79|^9.46|^10.0|^11.0|^12.0
laravel/scout Version ^9.0|^10.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 baril/sqlout contains the following files

Loading the files please wait ....