PHPackages                             winter/wn-search-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. winter/wn-search-plugin

ActiveWinter-plugin[Search &amp; Filtering](/categories/search)

winter/wn-search-plugin
=======================

Search plugin for Winter CMS

v1.0.0(1y ago)85.4k↓50%2[2 issues](https://github.com/wintercms/wn-search-plugin/issues)[1 PRs](https://github.com/wintercms/wn-search-plugin/pulls)1MITPHPPHP ^8.0CI passing

Since Jul 23Pushed 9mo ago5 watchersCompare

[ Source](https://github.com/wintercms/wn-search-plugin)[ Packagist](https://packagist.org/packages/winter/wn-search-plugin)[ Docs](https://github.com/wintercms/wn-search-plugin)[ GitHub Sponsors](https://github.com/wintercms)[ Fund](https://opencollective.com/wintercms)[ RSS](/packages/winter-wn-search-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (1)

Search Plugin
=============

[](#search-plugin)

[![Build Status](https://camo.githubusercontent.com/8cb8b4d4bf0f40e18f97f625bd83bad28c153f86efac7f73e0f584aa7583370f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f77696e746572636d732f776e2d7365617263682d706c7567696e2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d5465737473267374796c653d666c61742d737175617265)](https://github.com/wintercms/wn-search-plugin/actions)[![MIT License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/wintercms/wn-search-plugin/blob/master/LICENCE.md)[![Discord](https://camo.githubusercontent.com/9ccde68755bc7666e40d293b454327a4315cb3ed8e7839dfaee5d6dc46fc5d01/68747470733a2f2f696d672e736869656c64732e696f2f646973636f72642f3831363835323531333638343139333238313f6c6162656c3d646973636f7264267374796c653d666c61742d737175617265)](https://discord.gg/D5MFSPH6Ux)

Adds full-text searching capabilities to Winter, built on the foundations of [Laravel Scout](https://github.com/laravel/scout). The plugin acts primarily as a wrapper for Laravel Scout, and provides its entire suite of functionality within Winter's architecture, but also includes additional capabilities to make its use in Winter even easier.

Requirements
------------

[](#requirements)

- PHP 8.0 or above
- Winter CMS 1.2.0 or above (due to Laravel 9 requirement)

Getting started
---------------

[](#getting-started)

To install the plugin, you may install it through the [Winter CMS Marketplace](https://github.com/wintercms/wn-search-plugin), or you may install it using Composer:

```
composer require winter/wn-search-plugin
```

Then, run the migrations to ensure the plugin is enabled:

```
php artisan winter:up
```

Configuration
-------------

[](#configuration)

Configuration for this plugin is chiefly done through the `search.php` configuration file. You can publish this configuration into your project's `config` directory by running the following command:

```
php artisan vendor:publish --provider="Winter\Search\Plugin"
```

This will create your own configuration file at `config/winter/search/search.php`, in which you will be able to override all default configuration values.

Preparing your models
---------------------

[](#preparing-your-models)

As this is a wrapper, you can use [all the base functionality](https://laravel.com/docs/9.x/scout) that Laravel Scout provides. There are only a couple of subtle differences with the Search plugin's implementation:

- Configuration values are stored within the `search` key. Wherever there is mention of a `scout` configuration value, you must use `search` instead.
- Soft deleted models are determined by the usage of the `Winter\Storm\Database\Traits\SoftDelete` trait, not the base Laravel `SoftDeletes` trait.

To make a particular database model searchable, you simply add the `Winter\Search\Behaviors\Searchable` behavior to that model. This behavior will register a model observer that will automatically synchronise the model records to an index:

```
