- Can I use symfony/ai-maria-db-store directly in Laravel without Symfony?
- No, this package is Symfony-specific and requires Symfony’s AI Store interface. For Laravel, you’d need to create a bridge (e.g., a custom service provider or facade) to map Symfony’s `AiStoreInterface` to Laravel’s container. Alternatively, use raw PDO or a Laravel-compatible vector store like `laravel-ai/vector` for tighter integration.
- What Laravel versions support symfony/ai-maria-db-store?
- Laravel 10.x or 11.x with PHP 8.2+ can technically use this package, but it’s not natively supported. You’ll need to manually resolve Symfony’s dependencies (e.g., `symfony/dependency-injection`) and configure Laravel’s service container. Test thoroughly, as Symfony’s AI stack may introduce compatibility quirks.
- How do I configure MariaDB 11.7+ for vector search in Laravel?
- First, upgrade MariaDB to 11.7+ and enable the `vector` engine. Then, create a table with a `VECTOR` column (e.g., `embedding VECTOR(1536)`) and a `VECTOR INDEX`. For Laravel, use raw PDO or a repository pattern to avoid Eloquent conflicts. Example: `ALTER TABLE documents ADD COLUMN embedding VECTOR(1536); CREATE VECTOR INDEX idx_embedding ON documents(embedding);`
- What are the performance limits of MariaDB vector search in production?
- MariaDB’s vector search is CPU-bound and lacks GPU acceleration. Expect latency spikes for datasets >1M vectors or QPS >1K. For high throughput, consider caching (e.g., Redis) or sharding. Benchmark against alternatives like `pgvector` or dedicated vector databases (e.g., Milvus) if scalability is critical.
- How do I migrate existing vector data (e.g., from Elasticsearch) to MariaDB?
- Export your embeddings as CSV/JSON, then use Laravel’s DB migrations or raw SQL to insert into the `VECTOR` column. Example: `INSERT INTO documents (embedding) VALUES (VECTOR('...'));`. For large datasets, batch inserts and monitor MariaDB’s vector index rebuilds to avoid locks.
- Will this package work with Laravel Scout or Eloquent models?
- No, this package is designed for Symfony’s AI Store and doesn’t integrate with Laravel Scout or Eloquent’s query builder. Use raw PDO or a repository pattern to interact with MariaDB’s vector tables. For Eloquent, consider abstracting the vector store behind a custom trait or service.
- Are there alternatives to symfony/ai-maria-db-store for Laravel?
- Yes. For PostgreSQL, use `anahkiasen/pgvector` (via `laravel-ai/vector`). For dedicated vector DBs, try `weaviate/weaviate` or `milvus-io/milvus`. If you need a pure Laravel solution, explore `spatie/laravel-ai` or build a custom vector store with `brick/math` for embeddings.
- How do I test vector queries in Laravel’s testing environment?
- Mock MariaDB’s vector functions using Laravel’s `DatabaseMigrations` or `DatabaseTransactions`. For unit tests, use a library like `mockery` to stub PDO calls to `VECTOR` or distance functions. Example: `DB::shouldReceive('select')->andReturn([...]);` in your test cases.
- What distance metrics does MariaDB support for vector search?
- MariaDB 11.7+ supports cosine, Euclidean (L2), and inner product distance metrics natively. Custom metrics require raw SQL workarounds. Example: `SELECT * FROM documents ORDER BY embedding <=> ? LIMIT 10;` for cosine similarity.
- How do I handle schema changes (e.g., adding a new VECTOR column) in Laravel deployments?
- Use Laravel migrations to alter tables, but be cautious—`ALTER TABLE` on large tables with `VECTOR INDEX` can lock the database. Schedule migrations during low-traffic periods. Example: `Schema::table('documents', function (Blueprint $table) { $table->vector('embedding', 1536); });`