- Can I use this package directly in Laravel without Symfony AI?
- No, this package requires Symfony AI as a dependency. You’ll need to install `symfony/ai` and bridge it into Laravel’s service container, which may introduce versioning conflicts or require custom Laravel service providers. If you’re not already using Symfony AI, consider alternatives like dedicated Laravel vector store packages.
- What Laravel versions does this package support?
- The package assumes PHP 8.1+ and Laravel 9/10+, but explicit Laravel version constraints aren’t documented. Verify compatibility with Symfony AI’s requirements, as Laravel’s DI system may need adjustments to resolve Symfony-specific interfaces. Test thoroughly in your Laravel version before production use.
- How do I integrate Cloudflare Vectorize into Laravel’s service container?
- You’ll need to create a Laravel service provider to bind the Symfony AI `Store` interface to the Cloudflare store implementation. Use Laravel’s `bind()` method in a provider’s `register()` method, then publish the configuration for Cloudflare API credentials. Example: `app()->bind(StoreInterface::class, function ($app) { return new CloudflareStore($app['config']['cloudflare']); });`
- What happens if Cloudflare Vectorize’s API changes or goes down?
- The package doesn’t include built-in retry logic or fallback mechanisms. Implement Laravel’s HTTP client with exponential backoff for retries, and log failures using Laravel’s logging system. For high availability, consider caching frequent queries locally or using a secondary vector store as a backup.
- Are there cost implications for using Cloudflare Vectorize in production?
- Yes, Cloudflare Vectorize operates on a pay-per-query and storage model. Monitor usage via Cloudflare’s dashboard or API, and set budget alerts. For cost-sensitive applications, evaluate batch operations to reduce query volume or explore self-hosted alternatives like Milvus or Qdrant.
- How do I handle data migration from an existing vector store to Cloudflare?
- Use Cloudflare’s bulk upsert API (NDJSON format) to migrate existing vectors. Ensure your Laravel models or DTOs align with Cloudflare’s schema requirements (e.g., unique IDs, embedding dimensions). For large datasets, implement chunked upserts and verify idempotency to avoid duplicates during retries.
- What are the alternatives to this package for Laravel?
- For Laravel-native solutions, consider packages like `spatie/laravel-ai` (for Pinecone/Weaviate) or `meilisearch/meilisearch-php` (for Meilisearch). If you need self-hosted options, explore `milvus-io/php-sdk` or `qdrant/qdrant-client`. These avoid Symfony AI dependencies and may offer better Laravel ecosystem integration.
- Does this package support hybrid search (e.g., combining vector and keyword search)?
- No, this package only supports vector similarity search via Cloudflare Vectorize. Hybrid search would require extending the package or using Cloudflare’s full-text search capabilities separately. For Laravel, consider combining this with a dedicated search engine like Algolia or Meilisearch.
- How do I test this package in a Laravel application?
- Mock the Cloudflare API responses using Laravel’s HTTP client or a testing library like `mockery`. Test upserts, queries, and deletions in isolation, then integrate with your Laravel models. Use Laravel’s `fresh()` method to reset the store between tests and verify error handling for API failures.
- Will this package work with Laravel’s queue system for async operations?
- Yes, but you’ll need to wrap Cloudflare operations in Laravel jobs. Use the `dispatch()` method to queue upserts or queries, and handle failures in the job’s `handle()` method. For long-running operations, consider Laravel’s `dispatchSync()` for immediate feedback during development.