Example of Algolia in spatie/freek.dev

File composer.json (link to Github)
{
    //
    "require": {
        "php": "^8.0",
        "algolia/algoliasearch-client-php": "^2.7",
        //
        "laravel/scout": "^8.3"
    },
    //
}
File app/Models/Post.php (link to Github)
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Post extends Model
{
    use Searchable;
    //
    public function toSearchableArray(): array
    {
        if (! $this->published) {
            return [];
        }

        $postAttributes = $this->toArray();

        unset($postAttributes['text']);

        return $postAttributes;
    }
    //
}
File app/Http/Livewire/SearchComponent.php (link to Github)
use App\Models\Post;
use Illuminate\Support\Collection;
use Livewire\Component;

class SearchComponent extends Component
{
    public string $query = '';

    public function render()
    {
        return view('livewire.search', [
            'results' => $this->getResults(),
        ]);
    }

    public function getResults(): Collection
    {
        if ($this->query === '') {
            return collect();
        }

        return Post::search($this->query)->take(30)->get();
    }
}