- Can I use this package in a Laravel app without Symfony AI Chat?
- No, this package is tightly coupled with Symfony AI Chat. You’d need to create custom adapters to bridge it with Laravel’s event/queue systems, which adds significant complexity and technical debt. Consider alternatives like Redis or database-based solutions if you’re not using Symfony AI.
- What Laravel versions support this package?
- The package requires PHP 8.2+ and Symfony 7.3+, which aligns with Laravel 10+. However, Symfony’s MessageStoreInterface may not integrate seamlessly with Laravel’s patterns without custom workarounds.
- How do I configure Cloudflare KV for this package?
- You’ll need to set up a Cloudflare KV namespace and configure API tokens via Laravel’s `.env` file. Use `CF_ACCOUNT_ID`, `CF_API_TOKEN`, and `CF_NAMESPACE_ID` environment variables. For production, avoid hardcoding credentials—use a secrets manager like HashiCorp Vault.
- Will this work for complex queries like 'all messages from user X'?
- No, Cloudflare KV is key-value only. You’ll need to denormalize data or maintain a secondary database table for indexing. For example, store metadata in PostgreSQL/MySQL and use KV only for message payloads.
- How does bulk operations (get/update) perform under high load?
- Cloudflare KV is edge-optimized for low latency, but bulk operations (e.g., `bulk_get` for 100+ messages) may introduce latency spikes. Benchmark with production-like volumes to validate performance, especially for real-time AI chat applications.
- What if my chat messages exceed Cloudflare KV’s 64KB limit?
- KV enforces a 64KB value size limit. For larger payloads (e.g., multi-media messages), compress data or store attachments externally (e.g., S3) and reference them via KV. Custom serialization logic may also help reduce payload size.
- Are there alternatives for Laravel AI message storage?
- Yes. For Laravel, consider Redis (via `predis/predis`), Upstash, or database-based solutions like Eloquent with JSON columns. If you’re not tied to Symfony AI, Laravel-specific packages or LangChain integrations may offer better flexibility.
- How do I handle serialization for Laravel Eloquent models?
- The package defaults to JSON, which may not handle complex Eloquent models (e.g., relationships, accessors). Use custom serialization (e.g., `spatie/array-to-object`) or flatten models into arrays before storing. Test edge cases like polymorphic relationships.
- Does this package support transactions or rollbacks?
- No, Cloudflare KV is not transactional. If your Laravel app requires ACID compliance, use a hybrid approach: KV for messages and PostgreSQL/MySQL for metadata/transactions. This adds complexity to data consistency.
- Where should I report issues or contribute to this package?
- Issues and pull requests must be filed in the [Symfony AI repository](https://github.com/symfony/ai). The package is maintained by the Symfony team, so Laravel-specific concerns may not receive direct support. Forking or creating a Laravel wrapper may be necessary.