Download the PHP package shabushabu/laravel-paradedb-search without Composer

On this page you can find all versions of the php package shabushabu/laravel-paradedb-search. 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-paradedb-search

ParadeDB Search for Laravel

Latest Version on Packagist Total Downloads

Integrates the pg_search Postgres extension by ParadeDB into Laravel

Supported minimum versions

PHP Laravel PostgreSQL pg_search
8.2 11.0 16 0.7.5

Installation

[!CAUTION] Please note that this is a new package and, even though it is well tested, it should be considered pre-release software

Before installing the package you should install and enable the pg_search extension.

You can then install the package via composer:

You can also publish the config file:

These are the contents of the published config file:

Usage

Add a bm25 index

Each model that you want to be searchable needs a corresponding bm25 index. These can be generated within a migration like so:

Preparing your model

Just add the Searchable trait to your model to enable search:

ParadeQL

ParadeDB Search for Laravel comes with a fluent builder for ParadeQL, a simple query language.

This builder can be passed as a condition to a search where method or used within the various ParadeDB expressions.

Basic query

Add an IN condition

Add an AND NOT condition

Boost a condition

Apply the slop operator

More complex example with a sub condition

Apply a simple filter

Apply a boolean filter

Apply a basic range filter

Apply an inclusive range filter

Apply an exclusive range filter

ParadeDB functions

For more complex operations, it will be necessary to use some of the provided ParadeDB functions, all of which have corresponding query expressions:

Get all the records

Get none of the records

Boost a query

Add a constant score

Perform a disjunction max query

The DisjunctionMax constructor also accepts an array of queries, so using the fluid interface might be more convenient for multiple queries:

This also allows you to conditionally add queries:

Search for a fuzzy term

Highlight search terms

Search for a phrase

Perform a phrase prefix query

Search within a given range

Here are the supported range types (all within the ShabuShabu\ParadeDB\Query\Expressions\Ranges namespace), plus their corresponding Postgres type:

Perform a regex query

Search for a term

Search for a set of terms

The above query can also be written in a fluid manner:

The term method allows you to conditionally add terms:

Perform a complex boolean query

Boolean queries can also be constructed in a fluid manner:

The two queries above are identical. The fluent methods allow you to conditionally add queries, though:

Sort by rank

Pagination

It's also possible to paginate the results. Both the paginate and simplePaginate methods use the underlying limit & offset functionality, so will be more performant:

Search parameters

The ParadeDB search function allows you to set a variety of parameters to fine-tune your search. All of these can be set here as well:

Hybrid search

Whenever a similarity query is provided, the package will automatically perform a hybrid search. Please note that a ParadeDB query is still required!

Search parameters

Similarly to the full-text search, there are also parameters you can set for a hybrid search:

Modifying the underlying query

Occasionally, it will be necessary to modify the base query, for example to eager-load some relationships. This can be accomplished like so:

A word of caution

While it is possible to combine ParadeDB queries with regular Eloquent queries, you will incur some performance penalties.

For optimal performance it is recommended to let the bm25 index do as much work as possible, so wherever possible you should use the built-in filters as well as limit & offset!

Getting help

If your issue has something to do with this package, then please use the issues and discussions!

If your issue is related to pg_search, tho, then please create a discussion in the ParadeDB repo.

To make this a bit easier, you can use the paradedb:help command that ships with this package:

Please note that this command is just an implementation of the paradedb.help() function. Please use this command wisely!

Testing

The tests require a PostgreSQL database, which can easily be set up by running the following script:

[!WARNING] Please note that both pg_search and pgvector extensions need to be available already.

Then run the tests:

Or with test coverage:

Or with type coverage:

Or run PHPStan:

ParadeDB test table

There is also a command that allows you to create and drop the built-in test table

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

Disclaimer

This is a 3rd party package and ShabuShabu is not affiliated with either Laravel or ParadeDB.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-paradedb-search with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.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 shabushabu/laravel-paradedb-search contains the following files

Loading the files please wait ....