Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Typesense Php Laravel Package

typesense/typesense-php

Official PHP client for the Typesense search API. Install via Composer with an HTTPlug-compatible HTTP client, then manage collections, documents, and searches using the Typesense server API. Includes examples and safe filter string escaping.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Search Infrastructure Modernization: Replace legacy Elasticsearch/OpenSearch implementations with a lightweight, open-source alternative (Typesense) for PHP/Laravel applications. Reduces operational overhead (no cluster management) while maintaining high performance for search-heavy features (e.g., e-commerce product search, documentation search, or internal tools).

  • Roadmap: AI/ML Integration: Leverage Typesense’s natural language search (NLS) models (v5.2.0+) to enable conversational search or semantic search without heavy NLP pipelines. Aligns with roadmap items for "smart search" or "voice search" features.

  • Build vs. Buy: Buy for core search functionality (avoids reinventing search relevance, indexing, or scaling). Build custom filters, ranking logic, or analytics on top of Typesense’s API. The PHP client abstracts 80% of boilerplate, reducing dev time for search features.

  • Use Cases:

    • E-commerce: Faceted search, typo tolerance, and multi-field ranking for product catalogs.
    • Internal Tools: Full-text search across documents, codebases, or knowledge bases (e.g., GitHub-like search).
    • Content Platforms: Real-time search for blogs, CMS, or user-generated content with synonyms/curation (v6.1.0+).
    • Analytics-Driven Features: Track search queries and clicks via Typesense’s analytics events (v5.0.0+) to A/B test search UIs or personalize results.
  • Cost Optimization: Replace paid Elasticsearch cloud tiers with self-hosted Typesense (or Typesense Cloud) for high-scale search at lower TCO. The PHP client supports schema cloning (v5.0.0+) to replicate environments (dev/staging/prod) efficiently.

  • Compliance/Privacy: Deploy Typesense on-premises or in private clouds to avoid vendor lock-in with cloud search providers. The client supports custom logging (v6.1.0+) for audit trails or compliance reporting.


When to Consider This Package

Adopt This Package If:

  • Your PHP/Laravel app requires sub-100ms search latency with minimal operational effort (Typesense is optimized for edge deployments).
  • You need typos tolerance, fuzzy search, or multi-field ranking without managing Elasticsearch clusters.
  • Your search use case fits Typesense’s strengths:
    • Structured data (e.g., products, articles, or records with schema).
    • Low-to-medium cardinality filters (e.g., category, price range, tags).
    • Real-time updates (e.g., live chat transcripts, IoT telemetry).
  • You’re already using Typesense Server (self-hosted or cloud) and want a native PHP integration.
  • Your team lacks Elasticsearch expertise but needs production-grade search.

Look Elsewhere If:

  • You require complex aggregations (e.g., nested objects, geospatial joins) beyond Typesense’s supported queries. Consider Elasticsearch or PostgreSQL with pg_trgm.
  • Your dataset is unstructured (e.g., raw text documents without schemas). Use Tantivy (Rust) or Meilisearch for pure full-text search.
  • You need machine learning pipelines (e.g., custom embeddings, transformers). Typesense’s NLS is limited to pre-trained models; pair with Weaviate or Vespa for advanced ML.
  • Your app is write-heavy (e.g., logging, time-series). Typesense is optimized for read-heavy workloads; use ClickHouse or TimescaleDB for write-heavy use cases.
  • You’re locked into JavaScript/TypeScript stacks. Use the official Typesense JS client for tighter integration.

Red Flags:

  • No active maintainer: While Typesense (the server) is actively developed, the PHP client’s last major release (v6.1.0) was in 2026. Monitor GitHub activity for critical bug fixes.
  • Laravel-specific gaps: The client is framework-agnostic. For Laravel, you’ll need to manually handle:
    • Queue jobs for bulk indexing.
    • Caching search results (e.g., with Laravel’s cache driver).
    • Rate limiting (Typesense doesn’t enforce this by default).
  • Schema migrations: Typesense’s schema changes (e.g., v30 breaking changes) may require client updates. Plan for compatibility testing.

How to Pitch It (Stakeholders)

For Executives:

"Typesense + PHP Client = Faster Search, Lower Costs"

  • Problem: Slow, expensive, or complex search infrastructure (e.g., Elasticsearch clusters, third-party APIs) is slowing down [feature X] and increasing cloud bills.
  • Solution: Replace it with Typesense, an open-source search engine optimized for speed and simplicity. The official PHP client lets our Laravel team integrate it in weeks, not months.
  • ROI:
    • 30–50% cost savings vs. managed Elasticsearch (self-hosted Typesense scales to 10K+ RPS on a single node).
    • Faster iterations: No need to wait for DevOps to scale clusters. Deploy Typesense as a Docker container or serverless function.
    • Future-proof: Built-in support for AI search (e.g., "Ask me anything" interfaces) via natural language models.
  • Risk Mitigation: Typesense is used by companies like Notion, Perplexity, and Discord for high-scale search. The PHP client is battle-tested with 268+ GitHub stars.

For Engineers:

"Why This Client Wins for Laravel"

  • Seamless Integration:
    • Works with Laravel’s service container (dependency inject the client via Typesense\Client).
    • Supports HTTP clients you already use (e.g., Guzzle, Symfony HTTP Client) via HTTPlug.
    • Zero boilerplate for CRUD: Index documents, search, and update schemas with fluent methods.
  • Performance:
    • Sub-50ms latency for typical queries (benchmarked against Elasticsearch).
    • Automatic retries for transient failures (500/408 errors).
  • Laravel-Specific Perks:
    • Pair with Laravel Queues to batch-index documents asynchronously.
    • Use Laravel Cache to store frequent search results (e.g., trending products).
    • Logging: Inject a custom PSR-3 logger (e.g., Monolog) for debugging or analytics.
  • Example Workflow:
    // Initialize (Laravel service provider)
    $client = new Typesense\Client([
        'nodes' => ['http://typesense:8108'],
        'api_key' => config('typesense.api_key'),
        'connection_timeout_seconds' => 2,
    ]);
    
    // Search products
    $searchResults = $client->collections('products')
        ->documents()
        ->search('query=wireless&query_by=name,description&filter_by=price<100');
    
    // Update schema (e.g., add a new field)
    $client->collections('products')->updateSchema(['fields' => [...]]);
    
    // Natural language search (v5.2.0+)
    $client->collections('docs')->documents()->search([
        'q' => 'What are the steps to reset my password?',
        'use_nl_search' => true,
    ]);
    
  • Migration Path:
    • Start with a single collection (e.g., products or articles).
    • Gradually replace legacy search endpoints with Typesense.
    • Use schema cloning (v5.0.0+) to replicate production data for testing.

For Data Teams:

"Search That Doesn’t Sacrifice Accuracy"

  • Precision: Typesense’s typo tolerance and phrasing search outperform naive SQL LIKE queries.
  • Analytics: Track search queries and clicks via analytics events (v5.0.0+) to:
    • Identify low-conversion search terms.
    • Personalize results (e.g., boost products based on user history).
  • Compliance: Self-host Typesense to avoid sending data to third-party search providers.

For PMs/Designers:

"Search Features Without the Dev Debt"

  • Deliver faster:
    • Enable faceted filters (e.g., "Price: $50–$100") in days, not weeks.
    • Add autocomplete using Typesense’s search API.
  • A/B test search UIs:
    • Use analytics events to compare performance of different query suggestions or ranking algorithms.
  • Example Roadmap Items:
    • "Implement 'Did you mean?' suggestions" → Use Typesense’s typo tolerance.
    • "Add voice search" → Combine Typesense’s NLS with a speech-to-text API.
    • "Search across user upload
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge