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.
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:
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.
"Typesense + PHP Client = Faster Search, Lower Costs"
"Why This Client Wins for Laravel"
Typesense\Client).// 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,
]);
"Search That Doesn’t Sacrifice Accuracy"
LIKE queries."Search Features Without the Dev Debt"
How can I help you explore Laravel packages today?