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

Ai Meilisearch Store Laravel Package

symfony/ai-meilisearch-store

Meilisearch Store integrates Meilisearch as a vector store for Symfony AI Store, enabling hybrid and vector/semantic search with semanticRatio support. Includes links to Meilisearch docs and points to the main Symfony AI repo for issues and PRs.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Vector Store Alignment: The package bridges Meilisearch with Symfony AI, enabling hybrid search (keyword + semantic) workflows. This is ideal for Laravel applications requiring RAG pipelines, recommendation engines, or semantic search without heavy custom development.
  • Symfony-Laravel Interoperability: While designed for Symfony, the package’s abstraction (StoreInterface) allows Laravel integration via Composer and custom service bindings. This reduces friction for teams using Symfony components in Laravel.
  • Hybrid Search Capabilities: Meilisearch’s semanticRatio and hybrid search APIs are a strong fit for use cases needing both keyword and vector relevance (e.g., e-commerce filters + AI recommendations).
  • Extensibility: The package’s modular design (e.g., query abstraction, CRUD operations) supports future extensions like custom scoring, multi-tenancy, or Laravel-specific caching layers.

Integration Feasibility

  • Laravel Compatibility:
    • Pros:
      • Meilisearch’s PHP SDK is stable and widely used.
      • Symfony’s StoreInterface can be wrapped in Laravel’s service container with minimal boilerplate.
      • Hybrid search queries can be exposed as Laravel routes/controllers (e.g., Route::post('/search/hybrid', [SearchController::class, 'hybrid'])).
    • Cons:
      • Laravel’s event system, queues, or caching (e.g., Redis) require manual integration.
      • Symfony’s dependency injection (DI) may feel unfamiliar to Laravel teams.
  • Vector Database Agnosticism:
    • The package abstracts Meilisearch-specific logic, making it easier to mock for testing or swap providers (e.g., for local development).
  • AI Pipeline Fit:
    • Integrates seamlessly with Symfony AI’s VectorStoreInterface, enabling use cases like document retrieval for LLMs, chatbot knowledge bases, or personalized content delivery.

Technical Risk

  • Dependency Complexity:
    • Symfony AI: Laravel teams unfamiliar with Symfony’s AI stack may face a learning curve. Mitigate by documenting Laravel-specific integration patterns (e.g., service providers, facades).
    • Meilisearch Setup: Requires a running instance (Docker/self-hosted/cloud). Risk: infrastructure drift if not containerized. Mitigate with Terraform/Ansible templates.
  • Performance Overhead:
    • Vector operations in Meilisearch are efficient, but Laravel’s ORM (Eloquent) or unoptimized queries may introduce latency.
    • Mitigation:
      • Batch vector additions/removals.
      • Cache frequent queries (e.g., Redis for hybrid search results).
      • Use Meilisearch’s async indexing for bulk operations.
  • Limited Laravel-Specific Features:
    • No built-in support for Laravel’s queues, events, or caching. These must be added as extensions.
    • Workaround: Create a Laravel-specific VectorStoreManager to handle these concerns.
  • Maturity:
    • Low stars/dependents indicate early-stage adoption. Risk: API changes or deprecations.
    • Mitigation:
      • Pin versions in composer.json (e.g., symfony/ai-meilisearch-store:^0.8).
      • Monitor Symfony AI’s roadmap for breaking changes.

Key Questions

  1. Use Case Precision:
    • Is hybrid search (keyword + vector) a core requirement, or would a lighter solution (e.g., pure vector search with meilisearch/meilisearch-php) suffice?
  2. Symfony vs. Laravel Trade-offs:
    • Will the team adopt Symfony components long-term, or is this a short-term bridge? If the latter, consider a custom Laravel wrapper (e.g., laravel-ai-meilisearch).
  3. Scaling Requirements:
    • How will Meilisearch handle Laravel’s request volume? Plan for:
      • Horizontal scaling (Meilisearch clusters).
      • Query optimization (e.g., filterableAttributes, rankingRules).
  4. Maintenance Ownership:
    • Who will handle updates if Symfony AI or Meilisearch APIs change? Options:
      • Contribute upstream.
      • Fork and maintain a Laravel-specific branch.
  5. Alternatives Assessment:
    • Compare with other vector stores:
      • PostgreSQL + pgvector: Lower cost, but requires SQL expertise.
      • Weaviate/Pinecone: Managed services with richer features (but vendor lock-in).
      • TypeORM/Doctrine ODM: For teams already using these ORMs.

Integration Approach

Stack Fit

  • Laravel + Symfony AI Integration:

    • Symfony AI Components:
      • Install via Composer:
        composer require symfony/ai-meilisearch-store
        
      • Use symfony/ai (v0.8+) for vector embeddings and AI orchestration.
    • Laravel Adapters:
      • Service Provider: Bind Symfony’s MeilisearchStore to Laravel’s container:
        // app/Providers/MeilisearchServiceProvider.php
        use Symfony\Component\AI\Store\MeilisearchStore;
        use Meilisearch\Client;
        
        public function register()
        {
            $this->app->singleton(MeilisearchStore::class, function ($app) {
                $client = new Client(
                    env('MEILISEARCH_HOST'),
                    env('MEILISEARCH_API_KEY')
                );
                return new MeilisearchStore($client, 'your_index_name');
            });
        }
        
      • Facade/Repository: Create a Laravel-friendly interface:
        // app/Repositories/VectorStore.php
        class VectorStore
        {
            public function __construct(private MeilisearchStore $store) {}
        
            public function addEmbedding(array $embedding, array $metadata): void
            {
                $this->store->add($embedding, $metadata);
            }
        
            public function hybridSearch(string $query, array $embedding, float $semanticRatio = 0.5): array
            {
                return $this->store->search($query, $embedding, $semanticRatio);
            }
        }
        
    • Hybrid Search Endpoint:
      // routes/web.php
      Route::post('/search/hybrid', [SearchController::class, 'hybrid']);
      
      // app/Http/Controllers/SearchController.php
      public function hybrid(Request $request, VectorStore $vectorStore)
      {
          $query = $request->input('q');
          $embedding = $request->input('embedding');
          $results = $vectorStore->hybridSearch($query, $embedding);
          return response()->json($results);
      }
      
  • Meilisearch Infrastructure:

    • Deployment Options:
      • Docker (official image): docker run -p 7700:7700 -e MEILI_MASTER_KEY=masterKey meilisearch/meilisearch
      • Cloud: Meilisearch Hosted.
      • Self-hosted: Kubernetes/VMs with Meilisearch’s scaling guide.
    • Index Design:
      • Define a schema with vector and metadata fields:
        {
          "primaryKey": "id",
          "fields": [
            { "name": "embedding", "type": "float[]", "dim": 384 },
            { "name": "content", "type": "text" },
            { "name": "category", "type": "string" }
          ]
        }
        
      • Configure hybrid search settings:
        {
          "rankingRules": [
            "semanticRatio",
            "typo",
            "words",
            "proximity",
            "attribute",
            "sort",
            "exactness"
          ]
        }
        

Migration Path

  1. Phase 1: Infrastructure Setup (1-2 days)

    • Deploy Meilisearch (Docker/cloud).
    • Configure Laravel environment variables (MEILISEARCH_HOST, MEILISEARCH_API_KEY).
    • Tools: Use meilisearch-php CLI for initial index setup.
  2. Phase 2: Core Integration (2-3 days)

    • Add symfony/ai-meilisearch-store to composer.json.
    • Implement the Service Provider and VectorStore repository.
    • Test basic CRUD:
      $vectorStore = app(VectorStore::class);
      $vectorStore->addEmbedding($embedding, ['content' => 'Laravel AI']);
      
    • Debugging: Use dd($vectorStore->search(...)) to inspect Meilisearch responses.
  3. Phase 3: Hybrid Search Implementation (2 days)

    • Add the /search/hybrid endpoint.
    • Test with sample queries:
      curl -X POST http://localhost/search/hybrid \
        -H "Content-Type: application/json" \
        -d '{"q": "Laravel", "embedding": [0.1, 0.2, ...], "semantic
      
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.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony