Download the PHP package sebastiansulinski/laravel-search without Composer

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

Lightweight search for Laravel 11 +

This package provides a simple, lightweight search component for Laravel 11+.

In contrast to the well known Laravel Scout, it allows models to be associated with more than one index with separate payload for each, which was the much needed feature for my current project.

Currently only typesense driver is available, but if you feel like contributing a different implementation feel free to submit a PR.

Installation

Configuration

Start by publishing vendor configuration file search.php

Within the configuration file update parameters for your selected driver and add all models to the models array:

You can also update the default queue the import job will run on using SEARCH_QUEUE_CONNECTION environment variable - otherwise the default queue will be used.

Typesense configuration

Add the following to your services.php config file and update accordingly:

Models

Each of the models defined within the configuration file under models array has to implement IndexableDocument and use SearchIndexable trait.

You will also need to implement two methods:

searchableAs

This method returns a list of indexes the record should be listed under.

toSearchableArray

This method returns the payload in the form of array with the key representing corresponding index.

You can also overwrite the shouldBeSearchable method to indicate whether the record should be indexed.

Register search request parameters for your given implementation

If you are using the built-in controller with the SearchRequest, within your AppServiceProvider::boot method add all relevant validation rules for a given index. These will be used with the Indexer::search method - if you are using different approach for the search, you can ignore these. By default, only index and params (as array) are validated - whatever you define via this method will be merged to it.

Disable default routes

To disable default routes add the following to your AppServiceProvider::register method:

Import records

The following command will import all records for all indexes using default queue.

You can also specify the index you'd like to import:

Remove index and all records

To remove the index and all its records use the following command:

Contributions

Contributions are welcome, but please make sure your code contains all necessary bells and whistles - pint it etc.


All versions of laravel-search with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
laravel/framework Version ^11.30
typesense/typesense-php Version ^4.9
laravel/pint Version ^1.18
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 sebastiansulinski/laravel-search contains the following files

Loading the files please wait ....