PHPackages                             synergitech/laravel-typesense-tools - 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. synergitech/laravel-typesense-tools

ActiveLibrary[Search &amp; Filtering](/categories/search)

synergitech/laravel-typesense-tools
===================================

This library adds tools for Typesense within Laravel

v1.0.0(3mo ago)047↓45%[1 PRs](https://github.com/SynergiTech/laravel-typesense-tools/pulls)MITPHPPHP ^8.2CI passing

Since Mar 26Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/SynergiTech/laravel-typesense-tools)[ Packagist](https://packagist.org/packages/synergitech/laravel-typesense-tools)[ Docs](https://github.com/synergitech/laravel-typesense-tools)[ RSS](/packages/synergitech-laravel-typesense-tools/feed)WikiDiscussions main Synced 3w ago

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

Laravel Typesense Tools
=======================

[](#laravel-typesense-tools)

This package adds Artisan commands that help manage Typesense Collections and Collection Aliases in Laravel applications using Laravel Scout.

Using Typesense with Scout requires you to define the schema in the Scout config file so we change the expected functions to `static` to reduce duplication. This means that the functions cannot reference `app()` or `config()` because they're executed too early in the booting process.

We make use of Typesense Collection Aliases so that schema changes can be gracefully deployed to our frontends without causing issues.

See the full examples in [`examples/models/User.php`](examples/models/User.php) and [`examples/config/scout.php`](examples/config/scout.php).

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

[](#requirements)

- PHP `^8.2`
- Laravel Framework `>=10.0`
- Laravel Scout `>=10.0`
- Typesense PHP client `>=5.1`

Installation
------------

[](#installation)

```
composer require synergitech/laravel-typesense-tools
```

Usage
-----

[](#usage)

Our environments typically have separated application/frontend and worker contexts and we also usually run a separate CLI context. The deployment runbook is usually as follows.

1. deploy new code to the CLI and run any migrations
2. deploy new code to the workers with an updated TYPESENSE\_VERSION\_SUFFIX. We typically use a date for the suffix for easy versioning, i.e. 20260325.
3. run `php artisan search:setup` to populate the new collections
4. when the queue is empty, the new collection schema fields are now available as `search:switch-alias` is run as the final queue job
5. deploy the new code to the frontend so the new fields are in use
6. (optional) run `php artisan search:cleanup` to remove the now unused collections and get some memory back

### Development

[](#development)

As the frontend is powered by Aliases, you can save yourself a little bit of effort by adding the following to the bottom of your DatabaseSeeder class.

```
\Illuminate\Support\Facades\Artisan::call(
    command: 'search:switch-alias',
    outputBuffer: $this->command->getOutput()->getOutput(),
);
```

This means that every time you or a colleague are starting from scratch, the Aliases will be created. Scout will automatically create the Collections as part of the new data being added.

If you aren't implicitly creating every Collection during your seeding process, you can swap in `search:setup` instead and that will make sure all the Collections exist and the Aliases are created.

Command reference
-----------------

[](#command-reference)

- `search:setup` to ensure collections exist and (optionally) import data.
- `search:switch-alias` to point aliases at the current index collections.
- `search:delete-suffix {suffix}` to remove old suffixed collections.
- `search:cleanup` to remove collections that are not referenced by an alias.

### `search:setup`

[](#searchsetup)

Populates all known collections and dispatches a `search:switch-alias` at the end. If `--only-index` is provided, it checks each Collection/Alias exists. The check is useful for confirming your schema works and there aren't any errors.

Options:

- `--only-index`: only verify/create collections.
- `--flush`: flush each model before importing.

Examples:

```
php artisan search:setup --only-index
php artisan search:setup --flush
```

### `search:switch-alias`

[](#searchswitch-alias)

Upserts each model's alias (`searchableAs`) to target the active collection (`indexableAs`). This is used automatically after a call to `search:setup`

```
php artisan search:switch-alias
```

### `search:delete-suffix {suffix}`

[](#searchdelete-suffix-suffix)

Deletes old collections named as:

- `_`

Example:

```
php artisan search:delete-suffix 20260325
```

### `search:cleanup`

[](#searchcleanup)

Finds and optionally deletes collections not currently referenced by any alias.

```
php artisan search:cleanup
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance82

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

92d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69f33cc173ab9f35c67cb1bbaabeb0b705f983f65253393525ccfc539abc260?d=identicon)[SynergiTech](/maintainers/SynergiTech)

---

Top Contributors

[![whoboy2](https://avatars.githubusercontent.com/u/7756456?v=4)](https://github.com/whoboy2 "whoboy2 (4 commits)")[![willpower232](https://avatars.githubusercontent.com/u/1619102?v=4)](https://github.com/willpower232 "willpower232 (3 commits)")[![williamrenfrew](https://avatars.githubusercontent.com/u/12625062?v=4)](https://github.com/williamrenfrew "williamrenfrew (1 commits)")

---

Tags

laravellaravel-scoutlaravelscouttypesense

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

### Embed Badge

![Health badge](/badges/synergitech-laravel-typesense-tools/health.svg)

```
[![Health](https://phpackages.com/badges/synergitech-laravel-typesense-tools/health.svg)](https://phpackages.com/packages/synergitech-laravel-typesense-tools)
```

###  Alternatives

[algolia/scout-extended

Scout Extended extends Laravel Scout adding algolia-specific features

4186.6M6](/packages/algolia-scout-extended)[matchish/laravel-scout-elasticsearch

Search among multiple models with ElasticSearch and Laravel Scout

7451.7M3](/packages/matchish-laravel-scout-elasticsearch)[jeroen-g/explorer

Next-gen Elasticsearch driver for Laravel Scout.

399654.3k](/packages/jeroen-g-explorer)[typesense/laravel-scout-typesense-driver

Laravel Scout Driver for Typesense

146664.1k3](/packages/typesense-laravel-scout-typesense-driver)[mozex/laravel-scout-bulk-actions

Import, flush, and queue-import all your Laravel Scout searchable models at once. Auto-discovers models, runs in bulk, tracks progress.

1437.7k](/packages/mozex-laravel-scout-bulk-actions)[romanstruk/manticore-scout-engine

Laravel Manticore Scout Engine

4820.2k](/packages/romanstruk-manticore-scout-engine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
